public class MixedAttribute extends Object implements Attribute
InterfaceHttpData.HttpDataType
Modifier and Type | Field and Description |
---|---|
protected long |
maxSize |
Constructor and Description |
---|
MixedAttribute(String name,
long limitSize) |
MixedAttribute(String name,
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
|
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.
|
File |
getFile() |
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.
|
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(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 |
setMaxSize(long maxSize)
Set the maxSize for this HttpData.
|
void |
setValue(String value)
Sets the value of this HttpData.
|
String |
toString() |
public MixedAttribute(String name, long limitSize)
public void setMaxSize(long maxSize)
HttpData
setMaxSize
in interface HttpData
public void checkSize(long newSize) throws IOException
HttpData
checkSize
in interface HttpData
IOException
public void addContent(ChannelBuffer buffer, boolean last) throws 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 oneIOException
public void delete()
HttpData
public byte[] get() throws IOException
HttpData
get
in interface HttpData
IOException
public ChannelBuffer getChannelBuffer() throws IOException
HttpData
getChannelBuffer
in interface HttpData
IOException
public Charset getCharset()
HttpData
getCharset
in interface HttpData
public String getString() throws IOException
HttpData
getString
in interface HttpData
IOException
public String getString(Charset encoding) throws IOException
HttpData
getString
in interface HttpData
encoding
- the charset to useIOException
public boolean isCompleted()
isCompleted
in interface HttpData
public boolean isInMemory()
HttpData
isInMemory
in interface HttpData
public long length()
HttpData
public boolean renameTo(File dest) throws IOException
HttpData
renameTo
in interface HttpData
dest
- destination file - must be not nullIOException
public void setCharset(Charset charset)
HttpData
setCharset
in interface HttpData
charset
- Charset to set - must be not nullpublic void setContent(ChannelBuffer buffer) throws IOException
HttpData
setContent
in interface HttpData
buffer
- must be not nullIOException
public void setContent(File file) throws IOException
HttpData
setContent
in interface HttpData
file
- must be not nullIOException
public void setContent(InputStream inputStream) throws IOException
HttpData
setContent
in interface HttpData
inputStream
- must be not nullIOException
public InterfaceHttpData.HttpDataType getHttpDataType()
getHttpDataType
in interface InterfaceHttpData
public String getName()
InterfaceHttpData
getName
in interface InterfaceHttpData
public int compareTo(InterfaceHttpData o)
compareTo
in interface Comparable<InterfaceHttpData>
public String getValue() throws IOException
Attribute
getValue
in interface Attribute
IOException
public void setValue(String value) throws IOException
Attribute
setValue
in interface Attribute
IOException
public ChannelBuffer getChunk(int length) throws IOException
HttpData
getChunk
in interface HttpData
IOException
public File getFile() throws IOException
getFile
in interface HttpData
IOException
- if this data is not represented by a fileCopyright © 2008-2016 The Netty Project. All Rights Reserved.