public class MixedFileUpload extends AbstractReferenceCounted implements FileUpload
InterfaceHttpData.HttpDataType
Constructor and Description |
---|
MixedFileUpload(String name,
String filename,
String contentType,
String contentTransferEncoding,
Charset charset,
long size,
long limitSize) |
MixedFileUpload(String name,
String filename,
String contentType,
String contentTransferEncoding,
Charset charset,
long size,
long limitSize,
String baseDir,
boolean deleteOnExit) |
Modifier and Type | Method and Description |
---|---|
void |
addContent(ByteBuf buffer,
boolean last)
Add the content from the ChannelBuffer
ReferenceCounted.release() ownership of buffer is transferred to this HttpData . |
void |
checkSize(long newSize)
Check if the new size is not reaching the max limit allowed.
|
int |
compareTo(InterfaceHttpData o) |
ByteBuf |
content()
Return the data which is held by this
ByteBufHolder . |
FileUpload |
copy()
Creates a deep copy of this
ByteBufHolder . |
protected void |
deallocate()
Called once
AbstractReferenceCounted.refCnt() is equals 0. |
long |
definedLength()
Returns the defined length of the HttpData.
|
void |
delete()
Deletes the underlying storage for a file item, including deleting any
associated temporary disk file.
|
FileUpload |
duplicate()
Duplicates this
ByteBufHolder . |
boolean |
equals(Object obj) |
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.
|
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.
|
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() |
long |
getMaxSize()
Returns the maxSize for this HttpData.
|
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.
|
int |
hashCode() |
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 getMethod to write an uploaded item to disk.
|
FileUpload |
replace(ByteBuf content)
Returns a new
ByteBufHolder which contains the specified content . |
FileUpload |
retain()
Increases the reference count by
1 . |
FileUpload |
retain(int increment)
Increases the reference count by the specified
increment . |
FileUpload |
retainedDuplicate()
Duplicates this
ByteBufHolder . |
void |
setCharset(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)
ReferenceCounted.release() ownership of buffer is transferred to this HttpData . |
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() |
FileUpload |
touch()
Records the current access location of this object for debugging purposes.
|
FileUpload |
touch(Object hint)
Records the current access location of this object with an additional arbitrary information for debugging
purposes.
|
refCnt, release, release, setRefCnt
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addContent, checkSize, definedLength, delete, get, getByteBuf, getCharset, getChunk, getFile, getMaxSize, getString, getString, isCompleted, isInMemory, length, renameTo, setCharset, setContent, setContent, setContent, setMaxSize
getHttpDataType, getName
compareTo
content
refCnt, release, release
public MixedFileUpload(String name, String filename, String contentType, String contentTransferEncoding, Charset charset, long size, long limitSize)
public String getContentTransferEncoding()
FileUpload
getContentTransferEncoding
in interface FileUpload
public String getFilename()
FileUpload
getFilename
in interface FileUpload
public void setContentTransferEncoding(String contentTransferEncoding)
FileUpload
setContentTransferEncoding
in interface FileUpload
public void setFilename(String filename)
FileUpload
setFilename
in interface FileUpload
public void setContentType(String contentType)
FileUpload
setContentType
in interface FileUpload
contentType
- Content Type to set - must be not nullpublic String getContentType()
FileUpload
getContentType
in interface FileUpload
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 FileUpload retainedDuplicate()
ByteBufHolder
ByteBufHolder
. This method returns a retained duplicate unlike ByteBufHolder.duplicate()
.retainedDuplicate
in interface ByteBufHolder
retainedDuplicate
in interface FileUpload
retainedDuplicate
in interface HttpData
ByteBuf.retainedDuplicate()
public FileUpload replace(ByteBuf content)
ByteBufHolder
ByteBufHolder
which contains the specified content
.replace
in interface ByteBufHolder
replace
in interface FileUpload
replace
in interface HttpData
public FileUpload touch()
ReferenceCounted
ResourceLeakDetector
. This method is a shortcut to touch(null)
.touch
in interface ByteBufHolder
touch
in interface FileUpload
touch
in interface HttpData
touch
in interface InterfaceHttpData
touch
in interface ReferenceCounted
public FileUpload touch(Object hint)
ReferenceCounted
ResourceLeakDetector
.touch
in interface ByteBufHolder
touch
in interface FileUpload
touch
in interface HttpData
touch
in interface InterfaceHttpData
touch
in interface ReferenceCounted
public FileUpload retain()
ReferenceCounted
1
.retain
in interface ByteBufHolder
retain
in interface FileUpload
retain
in interface HttpData
retain
in interface InterfaceHttpData
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 InterfaceHttpData
retain
in interface ReferenceCounted
public long getMaxSize()
HttpData
getMaxSize
in interface HttpData
public void setMaxSize(long maxSize)
HttpData
setMaxSize
in interface HttpData
public ByteBuf content()
ByteBufHolder
ByteBufHolder
.content
in interface ByteBufHolder
public void checkSize(long newSize) throws IOException
HttpData
checkSize
in interface HttpData
IOException
public long definedLength()
HttpData
FileUpload
or any known big Attribute
.definedLength
in interface HttpData
public Charset getCharset()
HttpData
getCharset
in interface HttpData
public String getName()
InterfaceHttpData
getName
in interface InterfaceHttpData
public void addContent(ByteBuf buffer, boolean last) throws IOException
HttpData
ReferenceCounted.release()
ownership of buffer
is transferred to this 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
protected void deallocate()
AbstractReferenceCounted
AbstractReferenceCounted.refCnt()
is equals 0.deallocate
in class AbstractReferenceCounted
public void delete()
HttpData
public byte[] get() throws IOException
HttpData
get
in interface HttpData
IOException
public ByteBuf getByteBuf() throws IOException
HttpData
getByteBuf
in interface HttpData
IOException
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 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(ByteBuf buffer) throws IOException
HttpData
ReferenceCounted.release()
ownership of buffer
is transferred to this 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 boolean isCompleted()
isCompleted
in interface HttpData
public InterfaceHttpData.HttpDataType getHttpDataType()
getHttpDataType
in interface InterfaceHttpData
public int compareTo(InterfaceHttpData o)
compareTo
in interface Comparable<InterfaceHttpData>
public ByteBuf 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–2024 The Netty Project. All rights reserved.