Class AbstractHttpData
java.lang.Object
io.netty.util.AbstractReferenceCounted
io.netty.handler.codec.http.multipart.AbstractHttpData
- All Implemented Interfaces:
ByteBufHolder
,HttpData
,InterfaceHttpData
,ReferenceCounted
,Comparable<InterfaceHttpData>
- Direct Known Subclasses:
AbstractDiskHttpData
,AbstractMemoryHttpData
Abstract HttpData implementation
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.handler.codec.http.multipart.InterfaceHttpData
InterfaceHttpData.HttpDataType
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractHttpData
(String name, Charset charset, long size) -
Method Summary
Modifier and TypeMethodDescriptionvoid
checkSize
(long newSize) Check if the new size is not reaching the max limit allowed.content()
Return the data which is held by thisByteBufHolder
.protected void
Called onceAbstractReferenceCounted.refCnt()
is equals 0.long
Returns the defined length of the HttpData.Returns the Charset passed by the browser or null if not defined.long
Returns the maxSize for this HttpData.getName()
Returns the name of this InterfaceHttpData.boolean
long
length()
Returns the size in byte of the InterfaceHttpDataretain()
Increases the reference count by1
.retain
(int increment) Increases the reference count by the specifiedincrement
.void
setCharset
(Charset charset) Set the Charset passed by the browser if definedprotected void
protected void
setCompleted
(boolean completed) void
setMaxSize
(long maxSize) Set the maxSize for this HttpData.abstract HttpData
touch()
Records the current access location of this object for debugging purposes.abstract HttpData
Records the current access location of this object with an additional arbitrary information for debugging purposes.Methods inherited from class io.netty.util.AbstractReferenceCounted
refCnt, release, release, setRefCnt
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface io.netty.handler.codec.http.multipart.HttpData
addContent, copy, delete, duplicate, get, getByteBuf, getChunk, getFile, getString, getString, isInMemory, renameTo, replace, retainedDuplicate, setContent, setContent, setContent
Methods inherited from interface io.netty.handler.codec.http.multipart.InterfaceHttpData
getHttpDataType
Methods inherited from interface io.netty.util.ReferenceCounted
refCnt, release, release
-
Field Details
-
STRIP_PATTERN
-
REPLACE_PATTERN
-
name
-
definedSize
protected long definedSize -
size
protected long size -
charset
-
completed
private boolean completed -
maxSize
private long maxSize
-
-
Constructor Details
-
AbstractHttpData
-
-
Method Details
-
getMaxSize
public long getMaxSize()Description copied from interface:HttpData
Returns the maxSize for this HttpData.- Specified by:
getMaxSize
in interfaceHttpData
-
setMaxSize
public void setMaxSize(long maxSize) Description copied from interface:HttpData
Set the maxSize for this HttpData. When limit will be reached, an exception will be raised. Setting it to (-1) means no limitation. By default, to be set from the HttpDataFactory.- Specified by:
setMaxSize
in interfaceHttpData
-
checkSize
Description copied from interface:HttpData
Check if the new size is not reaching the max limit allowed. The limit is always computed in terms of bytes.- Specified by:
checkSize
in interfaceHttpData
- Throws:
IOException
-
getName
Description copied from interface:InterfaceHttpData
Returns the name of this InterfaceHttpData.- Specified by:
getName
in interfaceInterfaceHttpData
-
isCompleted
public boolean isCompleted()- Specified by:
isCompleted
in interfaceHttpData
- Returns:
- True if the InterfaceHttpData is completed (all data are stored)
-
setCompleted
protected void setCompleted() -
setCompleted
protected void setCompleted(boolean completed) -
getCharset
Description copied from interface:HttpData
Returns the Charset passed by the browser or null if not defined.- Specified by:
getCharset
in interfaceHttpData
- Returns:
- the Charset passed by the browser or null if not defined.
-
setCharset
Description copied from interface:HttpData
Set the Charset passed by the browser if defined- Specified by:
setCharset
in interfaceHttpData
- Parameters:
charset
- Charset to set - must be not null
-
length
public long length()Description copied from interface:HttpData
Returns the size in byte of the InterfaceHttpData -
definedLength
public long definedLength()Description copied from interface:HttpData
Returns the defined length of the HttpData. If no Content-Length is provided in the request, the defined length is always 0 (whatever during decoding or in final state). If Content-Length is provided in the request, this is this given defined length. This value does not change, whatever during decoding or in the final state. This method could be used for instance to know the amount of bytes transmitted for one particular HttpData, for example oneFileUpload
or any known bigAttribute
.- Specified by:
definedLength
in interfaceHttpData
- Returns:
- the defined length of the HttpData
-
content
Description copied from interface:ByteBufHolder
Return the data which is held by thisByteBufHolder
.- Specified by:
content
in interfaceByteBufHolder
-
deallocate
protected void deallocate()Description copied from class:AbstractReferenceCounted
Called onceAbstractReferenceCounted.refCnt()
is equals 0.- Specified by:
deallocate
in classAbstractReferenceCounted
-
retain
Description copied from interface:ReferenceCounted
Increases the reference count by1
.- Specified by:
retain
in interfaceByteBufHolder
- Specified by:
retain
in interfaceHttpData
- Specified by:
retain
in interfaceInterfaceHttpData
- Specified by:
retain
in interfaceReferenceCounted
- Overrides:
retain
in classAbstractReferenceCounted
-
retain
Description copied from interface:ReferenceCounted
Increases the reference count by the specifiedincrement
.- Specified by:
retain
in interfaceByteBufHolder
- Specified by:
retain
in interfaceHttpData
- Specified by:
retain
in interfaceInterfaceHttpData
- Specified by:
retain
in interfaceReferenceCounted
- Overrides:
retain
in classAbstractReferenceCounted
-
touch
Description copied from interface:ReferenceCounted
Records the current access location of this object for debugging purposes. If this object is determined to be leaked, the information recorded by this operation will be provided to you viaResourceLeakDetector
. This method is a shortcut totouch(null)
.- Specified by:
touch
in interfaceByteBufHolder
- Specified by:
touch
in interfaceHttpData
- Specified by:
touch
in interfaceInterfaceHttpData
- Specified by:
touch
in interfaceReferenceCounted
- Overrides:
touch
in classAbstractReferenceCounted
-
touch
Description copied from interface:ReferenceCounted
Records the current access location of this object with an additional arbitrary information for debugging purposes. If this object is determined to be leaked, the information recorded by this operation will be provided to you viaResourceLeakDetector
.- Specified by:
touch
in interfaceByteBufHolder
- Specified by:
touch
in interfaceHttpData
- Specified by:
touch
in interfaceInterfaceHttpData
- Specified by:
touch
in interfaceReferenceCounted
-