public abstract class AbstractDiskHttpData extends AbstractHttpData
InterfaceHttpData.HttpDataType| Modifier and Type | Field and Description |
|---|---|
protected File |
file |
charset, completed, definedSize, name, size| Modifier | Constructor and Description |
|---|---|
protected |
AbstractDiskHttpData(String name,
Charset charset,
long size) |
| Modifier and Type | Method and Description |
|---|---|
void |
addContent(io.netty.buffer.ByteBuf 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.
|
protected abstract boolean |
deleteOnExit() |
byte[] |
get()
Returns the contents of the file item as an array of bytes.
|
protected abstract String |
getBaseDirectory() |
io.netty.buffer.ByteBuf |
getByteBuf()
Returns the content of the file item as a ByteBuf
|
io.netty.buffer.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.
|
protected abstract String |
getDiskFilename() |
File |
getFile() |
protected abstract String |
getPostfix() |
protected abstract String |
getPrefix() |
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 getMethod to write an uploaded item to disk.
|
void |
setContent(io.netty.buffer.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)
|
content, deallocate, getCharset, getName, isCompleted, length, retain, retain, setCharsetrefCnt, release, release, setRefCntclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetHttpDataTypecompareToprotected File file
protected abstract String getDiskFilename()
protected abstract String getPrefix()
protected abstract String getBaseDirectory()
protected abstract String getPostfix()
protected abstract boolean deleteOnExit()
public void setContent(io.netty.buffer.ByteBuf buffer)
throws IOException
HttpDatabuffer - must be not nullIOExceptionpublic void addContent(io.netty.buffer.ByteBuf buffer,
boolean last)
throws IOException
HttpDatabuffer - must be not null except if last is set to Falselast - True of the buffer is the last oneIOExceptionpublic void setContent(File file) throws IOException
HttpDatafile - must be not nullIOExceptionpublic void setContent(InputStream inputStream) throws IOException
HttpDatainputStream - must be not nullIOExceptionpublic void delete()
HttpDatapublic byte[] get()
throws IOException
HttpDataIOExceptionpublic io.netty.buffer.ByteBuf getByteBuf()
throws IOException
HttpDataIOExceptionpublic io.netty.buffer.ByteBuf getChunk(int length)
throws IOException
HttpDataIOExceptionpublic String getString() throws IOException
HttpDataIOExceptionpublic String getString(Charset encoding) throws IOException
HttpDataencoding - the charset to useIOExceptionpublic boolean isInMemory()
HttpDatapublic boolean renameTo(File dest) throws IOException
HttpDatadest - destination file - must be not nullIOExceptionpublic File getFile() throws IOException
IOException - if this data is not represented by a fileCopyright © 2008–2013 The Netty Project. All rights reserved.