public class MixedAttribute extends java.lang.Object implements Attribute
InterfaceHttpData.HttpDataType| Modifier and Type | Field and Description |
|---|---|
private Attribute |
attribute |
private long |
limitSize |
protected long |
maxSize |
| Constructor and Description |
|---|
MixedAttribute(java.lang.String name,
long limitSize) |
MixedAttribute(java.lang.String name,
java.lang.String value,
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
|
java.nio.charset.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.
|
java.io.File |
getFile() |
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.
|
java.lang.String |
getValue()
Returns the value of this HttpData.
|
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(java.io.File dest)
A convenience method to write an uploaded item to disk.
|
void |
setCharset(java.nio.charset.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(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 |
setMaxSize(long maxSize)
Set the maxSize for this HttpData.
|
void |
setValue(java.lang.String value)
Sets the value of this HttpData.
|
java.lang.String |
toString() |
private Attribute attribute
private final long limitSize
protected long maxSize
public MixedAttribute(java.lang.String name,
long limitSize)
public MixedAttribute(java.lang.String name,
java.lang.String value,
long limitSize)
public void setMaxSize(long maxSize)
HttpDatasetMaxSize in interface HttpDatapublic void checkSize(long newSize)
throws java.io.IOException
HttpDatapublic void addContent(ChannelBuffer buffer, boolean last) throws java.io.IOException
HttpDataaddContent in interface HttpDatabuffer - must be not null except if last is set to Falselast - True of the buffer is the last onejava.io.IOExceptionpublic void delete()
HttpDatapublic byte[] get()
throws java.io.IOException
HttpDatapublic ChannelBuffer getChannelBuffer() throws java.io.IOException
HttpDatagetChannelBuffer in interface HttpDatajava.io.IOExceptionpublic java.nio.charset.Charset getCharset()
HttpDatagetCharset in interface HttpDatapublic java.lang.String getString()
throws java.io.IOException
HttpDatapublic java.lang.String getString(java.nio.charset.Charset encoding)
throws java.io.IOException
HttpDatapublic boolean isCompleted()
isCompleted in interface HttpDatapublic boolean isInMemory()
HttpDataisInMemory in interface HttpDatapublic long length()
HttpDatapublic boolean renameTo(java.io.File dest)
throws java.io.IOException
HttpDatapublic void setCharset(java.nio.charset.Charset charset)
HttpDatasetCharset in interface HttpDatacharset - Charset to set - must be not nullpublic void setContent(ChannelBuffer buffer) throws java.io.IOException
HttpDatasetContent in interface HttpDatabuffer - must be not nulljava.io.IOExceptionpublic void setContent(java.io.File file)
throws java.io.IOException
HttpDatasetContent in interface HttpDatafile - must be not nulljava.io.IOExceptionpublic void setContent(java.io.InputStream inputStream)
throws java.io.IOException
HttpDatasetContent in interface HttpDatainputStream - must be not nulljava.io.IOExceptionpublic InterfaceHttpData.HttpDataType getHttpDataType()
getHttpDataType in interface InterfaceHttpDatapublic java.lang.String getName()
InterfaceHttpDatagetName in interface InterfaceHttpDatapublic int compareTo(InterfaceHttpData o)
compareTo in interface java.lang.Comparable<InterfaceHttpData>public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getValue()
throws java.io.IOException
Attributepublic void setValue(java.lang.String value)
throws java.io.IOException
Attributepublic ChannelBuffer getChunk(int length) throws java.io.IOException
HttpData