public class MixedFileUpload extends Object implements FileUpload
InterfaceHttpData.HttpDataType| Modifier and Type | Field and Description |
|---|---|
protected long |
maxSize |
| Constructor and Description |
|---|
MixedFileUpload(String name,
String filename,
String contentType,
String contentTransferEncoding,
Charset charset,
long size,
long limitSize) |
| Modifier and Type | Method and Description |
|---|---|
void |
addContent(ChannelBuffer buffer,
boolean last)
Add the content from the ChannelBuffer
|
void |
checkSize(long newSize)
Check if the new size is not reaching the max limit allowed.
|
int |
compareTo(InterfaceHttpData o) |
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()
Returns the content of the file item as a ChannelBuffer
|
Charset |
getCharset()
Returns the Charset passed by the browser or null if not defined.
|
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.
|
String |
getContentTransferEncoding()
Returns the Content-Transfer-Encoding
|
String |
getContentType()
Returns the content type passed by the browser or null if not defined.
|
File |
getFile() |
String |
getFilename()
Returns the original filename in the client's filesystem,
as provided by the browser (or other client software).
|
InterfaceHttpData.HttpDataType |
getHttpDataType() |
String |
getName()
Returns the name of this InterfaceHttpData.
|
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 |
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
|
boolean |
renameTo(File dest)
A convenience method to write an uploaded item to disk.
|
void |
setCharset(Charset charset)
Set the Charset passed by the browser if defined
|
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)
|
void |
setContentTransferEncoding(String contentTransferEncoding)
Set the Content-Transfer-Encoding type from String as 7bit, 8bit or binary
|
void |
setContentType(String contentType)
Set the Content Type passed by the browser if defined
|
void |
setFilename(String filename)
Set the original filename
|
void |
setMaxSize(long maxSize)
Set the maxSize for this HttpData.
|
String |
toString() |
public void setMaxSize(long maxSize)
HttpDatasetMaxSize in interface HttpDatapublic void checkSize(long newSize)
throws IOException
HttpDatacheckSize in interface HttpDataIOExceptionpublic void addContent(ChannelBuffer buffer, boolean last) throws IOException
HttpDataaddContent in interface HttpDatabuffer - must be not null except if last is set to Falselast - True of the buffer is the last oneIOExceptionpublic void delete()
HttpDatapublic byte[] get()
throws IOException
HttpDataget in interface HttpDataIOExceptionpublic ChannelBuffer getChannelBuffer() throws IOException
HttpDatagetChannelBuffer in interface HttpDataIOExceptionpublic Charset getCharset()
HttpDatagetCharset in interface HttpDatapublic String getContentType()
FileUploadgetContentType in interface FileUploadpublic String getContentTransferEncoding()
FileUploadgetContentTransferEncoding in interface FileUploadpublic String getFilename()
FileUploadgetFilename in interface FileUploadpublic String getString() throws IOException
HttpDatagetString in interface HttpDataIOExceptionpublic String getString(Charset encoding) throws IOException
HttpDatagetString in interface HttpDataencoding - the charset to useIOExceptionpublic boolean isCompleted()
isCompleted in interface HttpDatapublic boolean isInMemory()
HttpDataisInMemory in interface HttpDatapublic long length()
HttpDatapublic boolean renameTo(File dest) throws IOException
HttpDatarenameTo in interface HttpDatadest - destination file - must be not nullIOExceptionpublic void setCharset(Charset charset)
HttpDatasetCharset in interface HttpDatacharset - Charset to set - must be not nullpublic void setContent(ChannelBuffer buffer) throws IOException
HttpDatasetContent in interface HttpDatabuffer - must be not nullIOExceptionpublic void setContent(File file) throws IOException
HttpDatasetContent in interface HttpDatafile - must be not nullIOExceptionpublic void setContent(InputStream inputStream) throws IOException
HttpDatasetContent in interface HttpDatainputStream - must be not nullIOExceptionpublic void setContentType(String contentType)
FileUploadsetContentType in interface FileUploadcontentType - Content Type to set - must be not nullpublic void setContentTransferEncoding(String contentTransferEncoding)
FileUploadsetContentTransferEncoding in interface FileUploadpublic void setFilename(String filename)
FileUploadsetFilename in interface FileUploadpublic InterfaceHttpData.HttpDataType getHttpDataType()
getHttpDataType in interface InterfaceHttpDatapublic String getName()
InterfaceHttpDatagetName in interface InterfaceHttpDatapublic int compareTo(InterfaceHttpData o)
compareTo in interface Comparable<InterfaceHttpData>public ChannelBuffer getChunk(int length) throws IOException
HttpDatagetChunk in interface HttpDataIOExceptionpublic File getFile() throws IOException
getFile in interface HttpDataIOException - if this data is not represented by a fileCopyright © 2008-2015 The Netty Project. All Rights Reserved.