public abstract class AbstractMemoryHttpData extends AbstractHttpData
InterfaceHttpData.HttpDataType| 限定符和类型 | 字段和说明 |
|---|---|
protected boolean |
isRenamed |
charset, completed, definedSize, maxSize, name, size| 限定符 | 构造器和说明 |
|---|---|
protected |
AbstractMemoryHttpData(java.lang.String name,
java.nio.charset.Charset charset,
long size) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addContent(ChannelBuffer buffer,
boolean last)
Add the content from the ChannelBuffer
|
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()
Utility to go from a In Memory FileUpload
to a Disk (or another implementation) FileUpload
|
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 |
isInMemory()
Provides a hint as to whether or not the file contents will be read from
memory.
|
boolean |
renameTo(java.io.File dest)
A convenience method to write an uploaded item to disk.
|
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)
|
checkSize, getCharset, getName, isCompleted, length, setCharset, setMaxSizeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetHttpDataTypeprotected AbstractMemoryHttpData(java.lang.String name,
java.nio.charset.Charset charset,
long size)
public void setContent(ChannelBuffer buffer) throws java.io.IOException
HttpDatabuffer - must be not nulljava.io.IOExceptionpublic void setContent(java.io.InputStream inputStream)
throws java.io.IOException
HttpDatainputStream - must be not nulljava.io.IOExceptionpublic void addContent(ChannelBuffer buffer, boolean last) throws java.io.IOException
HttpDatabuffer - must be not null except if last is set to Falselast - True of the buffer is the last onejava.io.IOExceptionpublic void setContent(java.io.File file)
throws java.io.IOException
HttpDatafile - must be not nulljava.io.IOExceptionpublic void delete()
HttpDatapublic byte[] get()
HttpDatapublic java.lang.String getString()
HttpDatapublic java.lang.String getString(java.nio.charset.Charset encoding)
HttpDataencoding - the charset to usepublic ChannelBuffer getChannelBuffer()
public ChannelBuffer getChunk(int length) throws java.io.IOException
HttpDatajava.io.IOExceptionpublic boolean isInMemory()
HttpDatapublic boolean renameTo(java.io.File dest)
throws java.io.IOException
HttpDatadest - destination file - must be not nulljava.io.IOExceptionpublic java.io.File getFile()
throws java.io.IOException
java.io.IOException - if this data is not represented by a file