public abstract class AbstractDiskHttpData extends AbstractHttpData
InterfaceHttpData.HttpDataType
definedSize, size
限定符 | 构造器和说明 |
---|---|
protected |
AbstractDiskHttpData(java.lang.String name,
java.nio.charset.Charset charset,
long size) |
限定符和类型 | 方法和说明 |
---|---|
void |
addContent(ByteBuf buffer,
boolean last)
Add the content from the ChannelBuffer
ReferenceCounted.release() ownership of buffer is transferred to this HttpData . |
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 java.lang.String |
getBaseDirectory() |
ByteBuf |
getByteBuf()
Returns the content of the file item as a ByteBuf.
|
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 java.lang.String |
getDiskFilename() |
java.io.File |
getFile() |
protected abstract java.lang.String |
getPostfix() |
protected abstract java.lang.String |
getPrefix() |
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 getMethod to write an uploaded item to disk.
|
void |
setContent(ByteBuf buffer)
Set the content from the ChannelBuffer (erase any previous data)
ReferenceCounted.release() ownership of buffer is transferred to this HttpData . |
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)
|
HttpData |
touch()
Records the current access location of this object for debugging purposes.
|
HttpData |
touch(java.lang.Object hint)
Records the current access location of this object with an additional arbitrary information for debugging
purposes.
|
checkSize, content, deallocate, definedLength, getCharset, getMaxSize, getName, isCompleted, length, retain, retain, setCharset, setCompleted, setCompleted, setMaxSize
refCnt, release, release, setRefCnt
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
copy, duplicate, replace, retainedDuplicate
getHttpDataType
refCnt, release, release
protected AbstractDiskHttpData(java.lang.String name, java.nio.charset.Charset charset, long size)
protected abstract java.lang.String getDiskFilename()
protected abstract java.lang.String getPrefix()
protected abstract java.lang.String getBaseDirectory()
protected abstract java.lang.String getPostfix()
protected abstract boolean deleteOnExit()
public void setContent(ByteBuf buffer) throws java.io.IOException
HttpData
ReferenceCounted.release()
ownership of buffer
is transferred to this HttpData
.
buffer
- must be not nulljava.io.IOException
public void addContent(ByteBuf buffer, boolean last) throws java.io.IOException
HttpData
ReferenceCounted.release()
ownership of buffer
is transferred to this HttpData
.
buffer
- must be not null except if last is set to Falselast
- True of the buffer is the last onejava.io.IOException
public void setContent(java.io.File file) throws java.io.IOException
HttpData
file
- must be not nulljava.io.IOException
public void setContent(java.io.InputStream inputStream) throws java.io.IOException
HttpData
inputStream
- must be not nulljava.io.IOException
public void delete()
HttpData
public byte[] get() throws java.io.IOException
HttpData
java.io.IOException
public ByteBuf getByteBuf() throws java.io.IOException
HttpData
java.io.IOException
public ByteBuf getChunk(int length) throws java.io.IOException
HttpData
java.io.IOException
public java.lang.String getString() throws java.io.IOException
HttpData
java.io.IOException
public java.lang.String getString(java.nio.charset.Charset encoding) throws java.io.IOException
HttpData
encoding
- the charset to usejava.io.IOException
public boolean isInMemory()
HttpData
public boolean renameTo(java.io.File dest) throws java.io.IOException
HttpData
dest
- destination file - must be not nulljava.io.IOException
public java.io.File getFile() throws java.io.IOException
java.io.IOException
- if this data is not represented by a filepublic HttpData touch()
ReferenceCounted
ResourceLeakDetector
. This method is a shortcut to touch(null)
.touch
在接口中 ByteBufHolder
touch
在接口中 HttpData
touch
在接口中 InterfaceHttpData
touch
在接口中 ReferenceCounted
touch
在类中 AbstractHttpData
public HttpData touch(java.lang.Object hint)
ReferenceCounted
ResourceLeakDetector
.touch
在接口中 ByteBufHolder
touch
在接口中 HttpData
touch
在接口中 InterfaceHttpData
touch
在接口中 ReferenceCounted
touch
在类中 AbstractHttpData