Top Fields Constructors Methods
io.netty.contrib.handler.codec.http.multipart

pack-priv abstract Class AbstractMixedHttpData<D extends io.netty.contrib.handler.codec.http.multipart.HttpData>

extends ResourceSupport<HttpData, AbstractMixedHttpData<? extends HttpData>>
implements HttpData
Class Inheritance
All Implemented Interfaces
io.netty.contrib.handler.codec.http.multipart.HttpData, io.netty.contrib.handler.codec.http.multipart.InterfaceHttpData, io.netty5.util.Resource, java.lang.AutoCloseable, java.lang.Comparable
Known Direct Subclasses
io.netty.contrib.handler.codec.http.multipart.MixedAttribute, io.netty.contrib.handler.codec.http.multipart.MixedFileUpload
Imports
io.netty5.buffer.Buffer, .Drop, io.netty5.buffer.internal.ResourceSupport, io.netty.contrib.handler.codec.http.multipart.Helpers.ThrowingConsumer, java.io.File, .IOException, .InputStream, java.nio.charset.Charset

Field Summary

Modifier and TypeField and Description
pack-priv final String
pack-priv final boolean
private static final Drop<AbstractMixedHttpData<? extends HttpData>>
protected final long
pack-priv D

Constructor Summary

AccessConstructor and Description
pack-priv
AbstractMixedHttpData(long limitSize, String baseDir, boolean deleteOnExit, D initial)

Method Summary

Modifier and TypeMethod and Description
public void
addContent(Buffer
must be not null except if last is set to False
buffer
,
boolean
True of the buffer is the last one
last
)

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.addContent.

Add the content from the ChannelBuffer

Buffer#close() ownership of buffer is transferred to this HttpData.

protected void
protected void
public void
checkSize(long newSize)

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.checkSize.

Check if the new size is not reaching the max limit allowed.
public int
compareTo(InterfaceHttpData
the object to be compared.
o
)

Implements java.lang.Comparable.compareTo.

Compares this object with the specified object for order.
public D
protected RuntimeException
public long
definedLength()

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.definedLength.

Returns the defined length of the HttpData.
public void
delete()

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.delete.

Deletes the underlying storage for a file item, including deleting any associated temporary disk file.
public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public byte[]
get()

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.get.

Returns the contents of the file item as an array of bytes.
public Charset
getCharset()

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.getCharset.

Returns the Charset passed by the browser or null if not defined.
public Buffer
getChunk(int length)

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.getChunk.

Returns a ChannelBuffer for the content from the current position with at most length read bytes, increasing the current position of the Bytes read.
public File
public InterfaceHttpData.HttpDataType
public long
getMaxSize()

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.getMaxSize.

Returns the maxSize for this HttpData.
public String
getName()

Implements io.netty.contrib.handler.codec.http.multipart.InterfaceHttpData.getName.

Returns the name of this InterfaceHttpData.
public String
getString()

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.getString.

Returns the contents of the file item as a String, using the default character encoding.
public String
getString(Charset
the charset to use
encoding
)

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.getString.

Returns the contents of the file item as a String, using the specified charset.
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
public boolean
public boolean
isInMemory()

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.isInMemory.

Provides a hint as to whether or not the file contents will be read from memory.
public long
length()

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.length.

Returns the size in byte of the InterfaceHttpData
pack-priv abstract D
public boolean
renameTo(File
destination file - must be not null
dest
)

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.renameTo.

A convenience getMethod to write an uploaded item to disk.
public D
replace(Buffer content)

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.replace.

Returns a new HttpData which contains the specified content.
public void
setCharset(Charset
Charset to set - must be not null
charset
)

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.setCharset.

Set the Charset passed by the browser if defined
public void
setContent(Buffer
must be not null
buffer
)

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.setContent.

Set the content from the ChannelBuffer (erase any previous data)

Buffer#close() ownership of buffer is transferred to this HttpData.

public void
setContent(File
must be not null
file
)

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.setContent.

Set the content from the file (erase any previous data)
public void
setContent(InputStream
must be not null
inputStream
)

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.setContent.

Set the content from the inputStream (erase any previous data)
public void
setMaxSize(long maxSize)

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.setMaxSize.

Set the maxSize for this HttpData.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public <E extends Exception> void
usingBuffer(Helpers.ThrowingConsumer<Buffer, E>
The file item buffer callback
callback
)

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.usingBuffer.

Calls the passed callback to operate on the file item as a Buffer.
public <E extends Exception> void
usingContent(Helpers.ThrowingConsumer<Buffer, E>
The file item buffer callback
callback
)

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.usingContent.

Calls the passed callback to operate on the file item as a Buffer.
Inherited from io.netty5.buffer.internal.ResourceSupport:
acquireattachTraceclosecountBorrowsisAccessibleisOwnedmakeInaccessiblenotSendableExceptionprepareSendsendtouchunsafeGetDropunsafeSetDrop

Field Detail

baseDirback to summary
pack-priv final String baseDir
deleteOnExitback to summary
pack-priv final boolean deleteOnExit
dropback to summary
private static final Drop<AbstractMixedHttpData<? extends HttpData>> drop

Hides io.netty5.buffer.internal.ResourceSupport.drop.

limitSizeback to summary
protected final long limitSize
wrappedback to summary
pack-priv D wrapped

Constructor Detail

AbstractMixedHttpDataback to summary
pack-priv AbstractMixedHttpData(long limitSize, String baseDir, boolean deleteOnExit, D initial)

Method Detail

addContentback to summary
public void addContent(Buffer buffer, boolean last) throws IOException

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.addContent.

Doc from io.netty.contrib.handler.codec.http.multipart.HttpData.addContent.

Add the content from the ChannelBuffer

Buffer#close() ownership of buffer is transferred to this HttpData.

Parameters
buffer:Buffer

must be not null except if last is set to False

last:boolean

True of the buffer is the last one

Annotations
@Override
checkAccessibleback to summary
protected void checkAccessible()
checkAccessibleback to summary
protected void checkAccessible(Buffer cleanup)
checkSizeback to summary
public void checkSize(long newSize) throws IOException

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.checkSize.

Doc from io.netty.contrib.handler.codec.http.multipart.HttpData.checkSize.

Check if the new size is not reaching the max limit allowed. The limit is always computed in terms of bytes.

Annotations
@Override
compareToback to summary
public int compareTo(InterfaceHttpData o)

Implements java.lang.Comparable.compareTo.

Doc from java.lang.Comparable.compareTo.

Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

The implementor must ensure signum(x.compareTo(y)) == -signum(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception if and only if y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y) > 0 && y.compareTo(z) > 0) implies x.compareTo(z) > 0.

Finally, the implementor must ensure that x.compareTo(y)==0 implies that signum(x.compareTo(z)) == signum(y.compareTo(z)), for all z.

Parameters
o:InterfaceHttpData

the object to be compared.

Returns:int

a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Annotations
@Override
copyback to summary
public D copy()

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.copy.

Doc from io.netty.contrib.handler.codec.http.multipart.HttpData.copy.

Creates a deep copy of this HttpData.

Annotations
@SuppressWarnings:unchecked
@Override
createResourceClosedExceptionback to summary
protected RuntimeException createResourceClosedException()

Implements abstract io.netty5.buffer.internal.ResourceSupport.createResourceClosedException.

Annotations
@Override
definedLengthback to summary
public long definedLength()

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.definedLength.

Doc from io.netty.contrib.handler.codec.http.multipart.HttpData.definedLength.

Returns the defined length of the HttpData. If no Content-Length is provided in the request, the defined length is always 0 (whatever during decoding or in final state). If Content-Length is provided in the request, this is this given defined length. This value does not change, whatever during decoding or in the final state. This method could be used for instance to know the amount of bytes transmitted for one particular HttpData, for example one FileUpload or any known big Attribute.

Returns:long

the defined length of the HttpData

Annotations
@Override
deleteback to summary
public void delete()

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.delete.

Doc from io.netty.contrib.handler.codec.http.multipart.HttpData.delete.

Deletes the underlying storage for a file item, including deleting any associated temporary disk file.

Annotations
@Override
equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getback to summary
public byte[] get() throws IOException

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.get.

Doc from io.netty.contrib.handler.codec.http.multipart.HttpData.get.

Returns the contents of the file item as an array of bytes.

Note

this method will allocate a lot of memory, if the data is currently stored on the file system.

Returns:byte[]

the contents of the file item as an array of bytes.

Annotations
@Override
getCharsetback to summary
public Charset getCharset()

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.getCharset.

Doc from io.netty.contrib.handler.codec.http.multipart.HttpData.getCharset.

Returns the Charset passed by the browser or null if not defined.

Returns:Charset

the Charset passed by the browser or null if not defined.

Annotations
@Override
getChunkback to summary
public Buffer getChunk(int length) throws IOException

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.getChunk.

Doc from io.netty.contrib.handler.codec.http.multipart.HttpData.getChunk.

Returns a ChannelBuffer for the content from the current position with at most length read bytes, increasing the current position of the Bytes read. Once it arrives at the end, it returns an EMPTY_BUFFER and it resets the current position to 0.

Buffer ownersip: The buffer ownership of the returned buffer is transferred to the caller

Returns:Buffer

a ChannelBuffer for the content from the current position or an EMPTY_BUFFER if there is no more data to return

Annotations
@Override
getFileback to summary
public File getFile() throws IOException

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.getFile.

Returns:File

Doc from io.netty.contrib.handler.codec.http.multipart.HttpData.getFile.

the associated File if this data is represented in a file

Annotations
@Override
Exceptions
IOException:

Doc from io.netty.contrib.handler.codec.http.multipart.HttpData.getFile.

if this data is not represented by a file

getHttpDataTypeback to summary
public InterfaceHttpData.HttpDataType getHttpDataType()

Implements io.netty.contrib.handler.codec.http.multipart.InterfaceHttpData.getHttpDataType.

Returns:InterfaceHttpData.HttpDataType

Doc from io.netty.contrib.handler.codec.http.multipart.InterfaceHttpData.getHttpDataType.

The HttpDataType

Annotations
@Override
getMaxSizeback to summary
public long getMaxSize()

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.getMaxSize.

Doc from io.netty.contrib.handler.codec.http.multipart.HttpData.getMaxSize.

Returns the maxSize for this HttpData.

Annotations
@Override
getNameback to summary
public String getName()

Implements io.netty.contrib.handler.codec.http.multipart.InterfaceHttpData.getName.

Doc from io.netty.contrib.handler.codec.http.multipart.InterfaceHttpData.getName.

Returns the name of this InterfaceHttpData.

Annotations
@Override
getStringback to summary
public String getString() throws IOException

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.getString.

Doc from io.netty.contrib.handler.codec.http.multipart.HttpData.getString.

Returns the contents of the file item as a String, using the default character encoding.

Returns:String

the contents of the file item as a String, using the default character encoding.

Annotations
@Override
getStringback to summary
public String getString(Charset encoding) throws IOException

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.getString.

Doc from io.netty.contrib.handler.codec.http.multipart.HttpData.getString.

Returns the contents of the file item as a String, using the specified charset.

Parameters
encoding:Charset

the charset to use

Returns:String

the contents of the file item as a String, using the specified charset.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
isCompletedback to summary
public boolean isCompleted()

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.isCompleted.

Returns:boolean

Doc from io.netty.contrib.handler.codec.http.multipart.HttpData.isCompleted.

True if the InterfaceHttpData is completed (all data are stored)

Annotations
@Override
isInMemoryback to summary
public boolean isInMemory()

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.isInMemory.

Doc from io.netty.contrib.handler.codec.http.multipart.HttpData.isInMemory.

Provides a hint as to whether or not the file contents will be read from memory.

Returns:boolean

True if the file contents is in memory.

Annotations
@Override
lengthback to summary
public long length()

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.length.

Doc from io.netty.contrib.handler.codec.http.multipart.HttpData.length.

Returns the size in byte of the InterfaceHttpData

Returns:long

the size of the InterfaceHttpData

Annotations
@Override
makeDiskDataback to summary
pack-priv abstract D makeDiskData()
renameToback to summary
public boolean renameTo(File dest) throws IOException

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.renameTo.

Doc from io.netty.contrib.handler.codec.http.multipart.HttpData.renameTo.

A convenience getMethod to write an uploaded item to disk. If a previous one exists, it will be deleted. Once this getMethod is called, if successful, the new file will be out of the cleaner of the factory that creates the original InterfaceHttpData object.

Parameters
dest:File

destination file - must be not null

Returns:boolean

True if the write is successful

Annotations
@Override
replaceback to summary
public D replace(Buffer content)

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.replace.

Doc from io.netty.contrib.handler.codec.http.multipart.HttpData.replace.

Returns a new HttpData which contains the specified content.

Annotations
@SuppressWarnings:unchecked
@Override
setCharsetback to summary
public void setCharset(Charset charset)

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.setCharset.

Doc from io.netty.contrib.handler.codec.http.multipart.HttpData.setCharset.

Set the Charset passed by the browser if defined

Parameters
charset:Charset

Charset to set - must be not null

Annotations
@Override
setContentback to summary
public void setContent(Buffer buffer) throws IOException

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.setContent.

Doc from io.netty.contrib.handler.codec.http.multipart.HttpData.setContent.

Set the content from the ChannelBuffer (erase any previous data)

Buffer#close() ownership of buffer is transferred to this HttpData.

Parameters
buffer:Buffer

must be not null

Annotations
@Override
setContentback to summary
public void setContent(File file) throws IOException

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.setContent.

Doc from io.netty.contrib.handler.codec.http.multipart.HttpData.setContent.

Set the content from the file (erase any previous data)

Parameters
file:File

must be not null

Annotations
@Override
setContentback to summary
public void setContent(InputStream inputStream) throws IOException

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.setContent.

Doc from io.netty.contrib.handler.codec.http.multipart.HttpData.setContent.

Set the content from the inputStream (erase any previous data)

Parameters
inputStream:InputStream

must be not null

Annotations
@Override
setMaxSizeback to summary
public void setMaxSize(long maxSize)

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.setMaxSize.

Doc from io.netty.contrib.handler.codec.http.multipart.HttpData.setMaxSize.

Set the maxSize for this HttpData. When limit will be reached, an exception will be raised. Setting it to (-1) means no limitation. By default, to be set from the HttpDataFactory.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
usingBufferback to summary
public <E extends Exception> void usingBuffer(Helpers.ThrowingConsumer<Buffer, E> callback) throws IOException, ThrowingConsumer-:E

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.usingBuffer.

Doc from io.netty.contrib.handler.codec.http.multipart.HttpData.usingBuffer.

Calls the passed callback to operate on the file item as a Buffer.

Note

this method will allocate a lot of memory, if the data is currently stored on the file system.

Buffer ownersip:

The ownership of the buffer passed to the callack is not transferred and remains to this HttpData interface.
  • for memory based http data, the internal buffer is directly passed to the callback.
  • for disk based http data, a copy of the file content is passed to the callback and is immediately closed once the callback returns.
Parameters
<E>
the type of the exception thrown by the callback
callback:Helpers.ThrowingConsumer<Buffer, E>

The file item buffer callback

Annotations
@Override
Exceptions
IOException:
if the method can't load the buffer from disk
usingContentback to summary
public <E extends Exception> void usingContent(Helpers.ThrowingConsumer<Buffer, E> callback) throws ThrowingConsumer-:E

Implements io.netty.contrib.handler.codec.http.multipart.HttpData.usingContent.

Doc from io.netty.contrib.handler.codec.http.multipart.HttpData.usingContent.

Calls the passed callback to operate on the file item as a Buffer.

Note

this method will allocate a lot of memory, if the data is currently stored on the file system.

Buffer ownersip:

The ownership of the buffer passed to the callack is not transferred and remains to this HttpData interface.
  • for memory based http data, the internal buffer is directly passed to the callback.
  • for disk based http data, a copy of the file content is passed to the callback and is immediately closed once the callback returns.
Parameters
<E>
the type of the exception thrown by the callback
callback:Helpers.ThrowingConsumer<Buffer, E>

The file item buffer callback

Annotations
@Override