public abstract class AbstractMemoryHttpData extends AbstractHttpData
InterfaceHttpData.HttpDataType
Modifier and Type | Field and Description |
---|---|
protected boolean |
isRenamed |
charset, completed, definedSize, maxSize, name, size
Modifier | Constructor and Description |
---|---|
protected |
AbstractMemoryHttpData(String name,
Charset charset,
long size) |
Modifier and Type | Method and Description |
---|---|
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.
|
File |
getFile() |
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 |
isInMemory()
Provides a hint as to whether or not the file contents will be read from
memory.
|
boolean |
renameTo(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(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)
|
checkSize, getCharset, getName, isCompleted, length, setCharset, setMaxSize
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getHttpDataType
compareTo
public void setContent(ChannelBuffer buffer) throws IOException
HttpData
buffer
- must be not nullIOException
public void setContent(InputStream inputStream) throws IOException
HttpData
inputStream
- must be not nullIOException
public void addContent(ChannelBuffer buffer, boolean last) throws IOException
HttpData
buffer
- must be not null except if last is set to Falselast
- True of the buffer is the last oneIOException
public void setContent(File file) throws IOException
HttpData
file
- must be not nullIOException
public void delete()
HttpData
public byte[] get()
HttpData
public String getString()
HttpData
public String getString(Charset encoding)
HttpData
encoding
- the charset to usepublic ChannelBuffer getChannelBuffer()
public ChannelBuffer getChunk(int length) throws IOException
HttpData
IOException
public boolean isInMemory()
HttpData
public boolean renameTo(File dest) throws IOException
HttpData
dest
- destination file - must be not nullIOException
public File getFile() throws IOException
IOException
- if this data is not represented by a fileCopyright © 2008-2016 The Netty Project. All Rights Reserved.