Top Description Methods
io.netty.handler.codec.http.multipart

public Interface HttpData

extends InterfaceHttpData, ByteBufHolder
Known Direct Subinterfaces
io.netty.handler.codec.http.multipart.Attribute, io.netty.handler.codec.http.multipart.FileUpload
Known Direct Implementers
io.netty.handler.codec.http.multipart.AbstractHttpData, io.netty.handler.codec.http.multipart.AbstractMixedHttpData
Imports
io.netty.buffer.ByteBuf, .ByteBufHolder, java.io.File, .IOException, .InputStream, java.nio.charset.Charset

Extended interface for InterfaceHttpData

Method Summary

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

Add the content from the ChannelBuffer

ByteBuf#release() ownership of buffer is transferred to this HttpData.

public void
checkSize(long newSize)

Check if the new size is not reaching the max limit allowed.

public HttpData
copy()

Redeclares io.netty.buffer.ByteBufHolder.copy.

Creates a deep copy of this ByteBufHolder.
public long

Returns:

the defined length of the HttpData
definedLength
()

Returns the defined length of the HttpData.

public void
delete()

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

public HttpData
public byte[]

Returns:

the contents of the file item as an array of bytes.
get
()

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

public ByteBuf

Returns:

the content of the file item as a ByteBuf
getByteBuf
()

Returns the content of the file item as a ByteBuf.

public Charset

Returns:

the Charset passed by the browser or null if not defined.
getCharset
()

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

public ByteBuf

Returns:

a ChannelBuffer for the content from the current position or an EMPTY_BUFFER if there is no more data to return
getChunk
(int length)

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

Returns:

the associated File if this data is represented in a file
getFile
()

public long
getMaxSize()

Returns the maxSize for this HttpData.

public String

Returns:

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

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

public String

Returns:

the contents of the file item as a String, using the specified charset.
getString
(Charset
the charset to use
encoding
)

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

public boolean

Returns:

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

public boolean

Returns:

True if the file contents is in memory.
isInMemory
()

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

public long

Returns:

the size of the InterfaceHttpData
length
()

Returns the size in byte of the InterfaceHttpData

public boolean

Returns:

True if the write is successful
renameTo
(File
destination file - must be not null
dest
)

A convenience getMethod to write an uploaded item to disk.

public HttpData
replace(ByteBuf content)

Redeclares io.netty.buffer.ByteBufHolder.replace.

Returns a new ByteBufHolder which contains the specified content.
public HttpData
public HttpData
retain(int increment)

Redeclares io.netty.handler.codec.http.multipart.InterfaceHttpData.retain, io.netty.buffer.ByteBufHolder.retain.

Increases the reference count by the specified increment.
public HttpData
public void
setCharset(Charset
Charset to set - must be not null
charset
)

Set the Charset passed by the browser if defined

public void
setContent(ByteBuf
must be not null
buffer
)

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

ByteBuf#release() ownership of buffer is transferred to this HttpData.

public void
setContent(File
must be not null
file
)

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

public void
setContent(InputStream
must be not null
inputStream
)

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

public void
setMaxSize(long maxSize)

Set the maxSize for this HttpData.

public HttpData
touch()

Redeclares io.netty.handler.codec.http.multipart.InterfaceHttpData.touch, io.netty.buffer.ByteBufHolder.touch.

Records the current access location of this object for debugging purposes.
public HttpData
touch(Object hint)

Redeclares io.netty.handler.codec.http.multipart.InterfaceHttpData.touch, io.netty.buffer.ByteBufHolder.touch.

Records the current access location of this object with an additional arbitrary information for debugging purposes.
Inherited from io.netty.buffer.ByteBufHolder:
content
Inherited from io.netty.handler.codec.http.multipart.InterfaceHttpData:
getHttpDataTypegetName

Method Detail

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

Add the content from the ChannelBuffer

ByteBuf#release() ownership of buffer is transferred to this HttpData.

Parameters
buffer:ByteBuf

must be not null except if last is set to False

last:boolean

True of the buffer is the last one

checkSizeback to summary
public void checkSize(long newSize) throws IOException

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

copyback to summary
public HttpData copy()

Redeclares io.netty.buffer.ByteBufHolder.copy.

Doc from io.netty.buffer.ByteBufHolder.copy.

Creates a deep copy of this ByteBufHolder.

Annotations
@Override
definedLengthback to summary
public long 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

deleteback to summary
public void delete()

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

duplicateback to summary
public HttpData duplicate()

Redeclares io.netty.buffer.ByteBufHolder.duplicate.

Doc from io.netty.buffer.ByteBufHolder.duplicate.

Duplicates this ByteBufHolder. Be aware that this will not automatically call retain().

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

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.

getByteBufback to summary
public ByteBuf getByteBuf() throws IOException

Returns the content of the file item as a ByteBuf.

Note

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

Returns:ByteBuf

the content of the file item as a ByteBuf

getCharsetback to summary
public Charset 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.

getChunkback to summary
public ByteBuf getChunk(int length) throws IOException

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.

Returns:ByteBuf

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

getFileback to summary
public File getFile() throws IOException
Returns:File

the associated File if this data is represented in a file

Exceptions
IOException:
if this data is not represented by a file
getMaxSizeback to summary
public long getMaxSize()

Returns the maxSize for this HttpData.

getStringback to summary
public String getString() throws IOException

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.

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

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.

isCompletedback to summary
public boolean isCompleted()
Returns:boolean

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

isInMemoryback to summary
public boolean 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.

lengthback to summary
public long length()

Returns the size in byte of the InterfaceHttpData

Returns:long

the size of the InterfaceHttpData

renameToback to summary
public boolean renameTo(File dest) throws IOException

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

replaceback to summary
public HttpData replace(ByteBuf content)

Redeclares io.netty.buffer.ByteBufHolder.replace.

Doc from io.netty.buffer.ByteBufHolder.replace.

Returns a new ByteBufHolder which contains the specified content.

Annotations
@Override
retainback to summary
public HttpData retain()

Redeclares io.netty.handler.codec.http.multipart.InterfaceHttpData.retain, io.netty.buffer.ByteBufHolder.retain.

Doc from io.netty.util.ReferenceCounted.retain.

Increases the reference count by 1.

Annotations
@Override
retainback to summary
public HttpData retain(int increment)

Redeclares io.netty.handler.codec.http.multipart.InterfaceHttpData.retain, io.netty.buffer.ByteBufHolder.retain.

Doc from io.netty.util.ReferenceCounted.retain.

Increases the reference count by the specified increment.

Annotations
@Override
retainedDuplicateback to summary
public HttpData retainedDuplicate()

Redeclares io.netty.buffer.ByteBufHolder.retainedDuplicate.

Doc from io.netty.buffer.ByteBufHolder.retainedDuplicate.

Duplicates this ByteBufHolder. This method returns a retained duplicate unlike duplicate().

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

Set the Charset passed by the browser if defined

Parameters
charset:Charset

Charset to set - must be not null

setContentback to summary
public void setContent(ByteBuf buffer) throws IOException

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

ByteBuf#release() ownership of buffer is transferred to this HttpData.

Parameters
buffer:ByteBuf

must be not null

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

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

Parameters
file:File

must be not null

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

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

Parameters
inputStream:InputStream

must be not null

setMaxSizeback to summary
public void setMaxSize(long maxSize)

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.

touchback to summary
public HttpData touch()

Redeclares io.netty.handler.codec.http.multipart.InterfaceHttpData.touch, io.netty.buffer.ByteBufHolder.touch.

Doc from io.netty.util.ReferenceCounted.touch.

Records the current access location of this object for debugging purposes. If this object is determined to be leaked, the information recorded by this operation will be provided to you via ResourceLeakDetector. This method is a shortcut to touch(null).

Annotations
@Override
touchback to summary
public HttpData touch(Object hint)

Redeclares io.netty.handler.codec.http.multipart.InterfaceHttpData.touch, io.netty.buffer.ByteBufHolder.touch.

Doc from io.netty.util.ReferenceCounted.touch.

Records the current access location of this object with an additional arbitrary information for debugging purposes. If this object is determined to be leaked, the information recorded by this operation will be provided to you via ResourceLeakDetector.

Annotations
@Override