public interface HttpData extends InterfaceHttpData, ByteBufHolder
InterfaceHttpData.HttpDataType
Modifier and Type | Method and Description |
---|---|
void |
addContent(ByteBuf buffer,
boolean last)
Add the content from the ChannelBuffer
|
void |
checkSize(long newSize)
Check if the new size is not reaching the max limit allowed.
|
HttpData |
copy()
Creates a deep copy of this
ByteBufHolder . |
long |
definedLength()
Returns the defined length of the HttpData.
|
void |
delete()
Deletes the underlying storage for a file item, including deleting any
associated temporary disk file.
|
HttpData |
duplicate()
Duplicates this
ByteBufHolder . |
byte[] |
get()
Returns the contents of the file item as an array of bytes.
|
ByteBuf |
getByteBuf()
Returns the content of the file item as a ByteBuf
|
Charset |
getCharset()
Returns the Charset passed by the browser or null if not defined.
|
ByteBuf |
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.
|
File |
getFile() |
long |
getMaxSize()
Returns the maxSize for this HttpData.
|
String |
getString()
Returns the contents of the file item as a String, using the default
character encoding.
|
String |
getString(Charset encoding)
Returns the contents of the file item as a String, using the specified
charset.
|
boolean |
isCompleted() |
boolean |
isInMemory()
Provides a hint as to whether or not the file contents will be read from
memory.
|
long |
length()
Returns the size in byte of the InterfaceHttpData
|
boolean |
renameTo(File dest)
A convenience getMethod to write an uploaded item to disk.
|
HttpData |
replace(ByteBuf content)
Returns a new
ByteBufHolder which contains the specified content . |
HttpData |
retain()
Increases the reference count by
1 . |
HttpData |
retain(int increment)
Increases the reference count by the specified
increment . |
HttpData |
retainedDuplicate()
Duplicates this
ByteBufHolder . |
void |
setCharset(Charset charset)
Set the Charset passed by the browser if defined
|
void |
setContent(ByteBuf buffer)
Set the content from the ChannelBuffer (erase any previous data)
|
void |
setContent(File file)
Set the content from the file (erase any previous data)
|
void |
setContent(InputStream inputStream)
Set the content from the inputStream (erase any previous data)
|
void |
setMaxSize(long maxSize)
Set the maxSize for this HttpData.
|
HttpData |
touch()
Records the current access location of this object for debugging purposes.
|
HttpData |
touch(Object hint)
Records the current access location of this object with an additional arbitrary information for debugging
purposes.
|
getHttpDataType, getName
compareTo
content
refCnt, release, release
long getMaxSize()
void setMaxSize(long maxSize)
void checkSize(long newSize) throws IOException
IOException
void setContent(ByteBuf buffer) throws IOException
buffer
- must be not nullIOException
void addContent(ByteBuf buffer, boolean last) throws IOException
buffer
- must be not null except if last is set to Falselast
- True of the buffer is the last oneIOException
void setContent(File file) throws IOException
file
- must be not nullIOException
void setContent(InputStream inputStream) throws IOException
inputStream
- must be not nullIOException
boolean isCompleted()
long length()
long definedLength()
FileUpload
or any known big Attribute
.void delete()
byte[] get() throws IOException
IOException
ByteBuf getByteBuf() throws IOException
IOException
ByteBuf getChunk(int length) throws IOException
IOException
String getString() throws IOException
IOException
String getString(Charset encoding) throws IOException
encoding
- the charset to useIOException
void setCharset(Charset charset)
charset
- Charset to set - must be not nullCharset getCharset()
boolean renameTo(File dest) throws IOException
dest
- destination file - must be not nullIOException
boolean isInMemory()
File getFile() throws IOException
IOException
- if this data is not represented by a fileHttpData copy()
ByteBufHolder
ByteBufHolder
.copy
in interface ByteBufHolder
HttpData duplicate()
ByteBufHolder
ByteBufHolder
. Be aware that this will not automatically call ByteBufHolder.retain()
.duplicate
in interface ByteBufHolder
HttpData retainedDuplicate()
ByteBufHolder
ByteBufHolder
. This method returns a retained duplicate unlike ByteBufHolder.duplicate()
.retainedDuplicate
in interface ByteBufHolder
ByteBuf.retainedDuplicate()
HttpData replace(ByteBuf content)
ByteBufHolder
ByteBufHolder
which contains the specified content
.replace
in interface ByteBufHolder
HttpData retain()
ReferenceCounted
1
.retain
in interface ByteBufHolder
retain
in interface InterfaceHttpData
retain
in interface ReferenceCounted
HttpData retain(int increment)
ReferenceCounted
increment
.retain
in interface ByteBufHolder
retain
in interface InterfaceHttpData
retain
in interface ReferenceCounted
HttpData touch()
ReferenceCounted
ResourceLeakDetector
. This method is a shortcut to touch(null)
.touch
in interface ByteBufHolder
touch
in interface InterfaceHttpData
touch
in interface ReferenceCounted
HttpData touch(Object hint)
ReferenceCounted
ResourceLeakDetector
.touch
in interface ByteBufHolder
touch
in interface InterfaceHttpData
touch
in interface ReferenceCounted
Copyright © 2008–2017 The Netty Project. All rights reserved.