public interface HttpData extends InterfaceHttpData
InterfaceHttpData.HttpDataType
限定符和类型 | 方法和说明 |
---|---|
void |
addContent(ChannelBuffer 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.
|
void |
delete()
Deletes the underlying storage for a file item, including deleting any
associated temporary disk file.
|
byte[] |
get()
Returns the contents of the file item as an array of bytes.
|
ChannelBuffer |
getChannelBuffer()
Returns the content of the file item as a ChannelBuffer
|
java.nio.charset.Charset |
getCharset()
Returns the Charset passed by the browser or null if not defined.
|
ChannelBuffer |
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.
|
java.io.File |
getFile() |
java.lang.String |
getString()
Returns the contents of the file item as a String, using the default
character encoding.
|
java.lang.String |
getString(java.nio.charset.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(java.io.File dest)
A convenience method to write an uploaded item to disk.
|
void |
setCharset(java.nio.charset.Charset charset)
Set the Charset passed by the browser if defined
|
void |
setContent(ChannelBuffer buffer)
Set the content from the ChannelBuffer (erase any previous data)
|
void |
setContent(java.io.File file)
Set the content from the file (erase any previous data)
|
void |
setContent(java.io.InputStream inputStream)
Set the content from the inputStream (erase any previous data)
|
void |
setMaxSize(long maxSize)
Set the maxSize for this HttpData.
|
getHttpDataType, getName
void setMaxSize(long maxSize)
maxSize
- void checkSize(long newSize) throws java.io.IOException
newSize
- java.io.IOException
void setContent(ChannelBuffer buffer) throws java.io.IOException
buffer
- must be not nulljava.io.IOException
void addContent(ChannelBuffer buffer, boolean last) throws java.io.IOException
buffer
- must be not null except if last is set to Falselast
- True of the buffer is the last onejava.io.IOException
void setContent(java.io.File file) throws java.io.IOException
file
- must be not nulljava.io.IOException
void setContent(java.io.InputStream inputStream) throws java.io.IOException
inputStream
- must be not nulljava.io.IOException
boolean isCompleted()
long length()
void delete()
byte[] get() throws java.io.IOException
java.io.IOException
ChannelBuffer getChannelBuffer() throws java.io.IOException
java.io.IOException
ChannelBuffer getChunk(int length) throws java.io.IOException
java.io.IOException
java.lang.String getString() throws java.io.IOException
java.io.IOException
java.lang.String getString(java.nio.charset.Charset encoding) throws java.io.IOException
encoding
- the charset to usejava.io.IOException
void setCharset(java.nio.charset.Charset charset)
charset
- Charset to set - must be not nulljava.nio.charset.Charset getCharset()
boolean renameTo(java.io.File dest) throws java.io.IOException
dest
- destination file - must be not nulljava.io.IOException
boolean isInMemory()
java.io.File getFile() throws java.io.IOException
java.io.IOException
- if this data is not represented by a file