public class MixedFileUpload extends java.lang.Object implements FileUpload
InterfaceHttpData.HttpDataType
Constructor and Description |
---|
MixedFileUpload(java.lang.String name,
java.lang.String filename,
java.lang.String contentType,
java.lang.String contentTransferEncoding,
java.nio.charset.Charset charset,
long size,
long limitSize) |
Modifier and Type | Method and Description |
---|---|
void |
addContent(ByteBuf buffer,
boolean last)
Add the content from the ChannelBuffer
|
int |
compareTo(InterfaceHttpData o) |
ByteBuf |
content()
Return the data which is held by this
ByteBufHolder . |
FileUpload |
copy()
Create a deep copy of this
ByteBufHolder . |
void |
delete()
Deletes the underlying storage for a file item, including deleting any
associated temporary disk file.
|
FileUpload |
duplicate()
Duplicate the
ByteBufHolder . |
byte[] |
get()
Returns the contents of the file item as an array of bytes.
|
ByteBuf |
getByteBuf()
Returns the content of the file item as a ByteBuf
|
java.nio.charset.Charset |
getCharset()
Returns the Charset passed by the browser or null if not defined.
|
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.
|
java.lang.String |
getContentTransferEncoding()
Returns the Content-Transfer-Encoding
|
java.lang.String |
getContentType()
Returns the content type passed by the browser or null if not defined.
|
java.io.File |
getFile() |
java.lang.String |
getFilename()
Returns the original filename in the client's filesystem,
as provided by the browser (or other client software).
|
InterfaceHttpData.HttpDataType |
getHttpDataType() |
java.lang.String |
getName()
Returns the name of this InterfaceHttpData.
|
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
|
int |
refCnt()
Returns the reference count of this object.
|
boolean |
release()
Decreases the reference count by
1 and deallocates this object if the reference count reaches at
0 . |
boolean |
release(int decrement)
Decreases the reference count by the specified
decrement and deallocates this object if the reference
count reaches at 0 . |
boolean |
renameTo(java.io.File dest)
A convenience getMethod to write an uploaded item to disk.
|
FileUpload |
retain()
Increases the reference count by
1 . |
FileUpload |
retain(int increment)
Increases the reference count by the specified
increment . |
void |
setCharset(java.nio.charset.Charset charset)
Set the Charset passed by the browser if defined
|
void |
setContent(ByteBuf 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 |
setContentTransferEncoding(java.lang.String contentTransferEncoding)
Set the Content-Transfer-Encoding type from String as 7bit, 8bit or binary
|
void |
setContentType(java.lang.String contentType)
Set the Content Type passed by the browser if defined
|
void |
setFilename(java.lang.String filename)
Set the original filename
|
java.lang.String |
toString() |
public MixedFileUpload(java.lang.String name, java.lang.String filename, java.lang.String contentType, java.lang.String contentTransferEncoding, java.nio.charset.Charset charset, long size, long limitSize)
public void addContent(ByteBuf buffer, boolean last) throws java.io.IOException
HttpData
addContent
in interface 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 delete()
HttpData
public byte[] get() throws java.io.IOException
HttpData
public ByteBuf getByteBuf() throws java.io.IOException
HttpData
getByteBuf
in interface HttpData
java.io.IOException
public java.nio.charset.Charset getCharset()
HttpData
getCharset
in interface HttpData
public java.lang.String getContentType()
FileUpload
getContentType
in interface FileUpload
public java.lang.String getContentTransferEncoding()
FileUpload
getContentTransferEncoding
in interface FileUpload
public java.lang.String getFilename()
FileUpload
getFilename
in interface FileUpload
public java.lang.String getString() throws java.io.IOException
HttpData
public java.lang.String getString(java.nio.charset.Charset encoding) throws java.io.IOException
HttpData
public boolean isCompleted()
isCompleted
in interface HttpData
public boolean isInMemory()
HttpData
isInMemory
in interface HttpData
public long length()
HttpData
public boolean renameTo(java.io.File dest) throws java.io.IOException
HttpData
public void setCharset(java.nio.charset.Charset charset)
HttpData
setCharset
in interface HttpData
charset
- Charset to set - must be not nullpublic void setContent(ByteBuf buffer) throws java.io.IOException
HttpData
setContent
in interface HttpData
buffer
- must be not nulljava.io.IOException
public void setContent(java.io.File file) throws java.io.IOException
HttpData
setContent
in interface HttpData
file
- must be not nulljava.io.IOException
public void setContent(java.io.InputStream inputStream) throws java.io.IOException
HttpData
setContent
in interface HttpData
inputStream
- must be not nulljava.io.IOException
public void setContentType(java.lang.String contentType)
FileUpload
setContentType
in interface FileUpload
contentType
- Content Type to set - must be not nullpublic void setContentTransferEncoding(java.lang.String contentTransferEncoding)
FileUpload
setContentTransferEncoding
in interface FileUpload
public void setFilename(java.lang.String filename)
FileUpload
setFilename
in interface FileUpload
public InterfaceHttpData.HttpDataType getHttpDataType()
getHttpDataType
in interface InterfaceHttpData
public java.lang.String getName()
InterfaceHttpData
getName
in interface InterfaceHttpData
public int compareTo(InterfaceHttpData o)
compareTo
in interface java.lang.Comparable<InterfaceHttpData>
public java.lang.String toString()
toString
in class java.lang.Object
public ByteBuf getChunk(int length) throws java.io.IOException
HttpData
public java.io.File getFile() throws java.io.IOException
public FileUpload copy()
ByteBufHolder
ByteBufHolder
.copy
in interface ByteBufHolder
copy
in interface FileUpload
copy
in interface HttpData
public FileUpload duplicate()
ByteBufHolder
ByteBufHolder
. Be aware that this will not automatically call ByteBufHolder.retain()
.duplicate
in interface ByteBufHolder
duplicate
in interface FileUpload
duplicate
in interface HttpData
public ByteBuf content()
ByteBufHolder
ByteBufHolder
.content
in interface ByteBufHolder
public int refCnt()
ReferenceCounted
0
, it means this object has been deallocated.refCnt
in interface ReferenceCounted
public FileUpload retain()
ReferenceCounted
1
.retain
in interface ByteBufHolder
retain
in interface FileUpload
retain
in interface HttpData
retain
in interface ReferenceCounted
public FileUpload retain(int increment)
ReferenceCounted
increment
.retain
in interface ByteBufHolder
retain
in interface FileUpload
retain
in interface HttpData
retain
in interface ReferenceCounted
public boolean release()
ReferenceCounted
1
and deallocates this object if the reference count reaches at
0
.release
in interface ReferenceCounted
true
if and only if the reference count became 0
and this object has been deallocatedpublic boolean release(int decrement)
ReferenceCounted
decrement
and deallocates this object if the reference
count reaches at 0
.release
in interface ReferenceCounted
true
if and only if the reference count became 0
and this object has been deallocatedCopyright © 2008–2018 The Netty Project. All rights reserved.