Class AbstractHttpData
- java.lang.Object
-
- io.netty.util.AbstractReferenceCounted
-
- io.netty.handler.codec.http.multipart.AbstractHttpData
-
- All Implemented Interfaces:
io.netty.buffer.ByteBufHolder,HttpData,InterfaceHttpData,io.netty.util.ReferenceCounted,Comparable<InterfaceHttpData>
- Direct Known Subclasses:
AbstractDiskHttpData,AbstractMemoryHttpData
public abstract class AbstractHttpData extends io.netty.util.AbstractReferenceCounted implements HttpData
Abstract HttpData implementation
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.netty.handler.codec.http.multipart.InterfaceHttpData
InterfaceHttpData.HttpDataType
-
-
Field Summary
Fields Modifier and Type Field Description protected longdefinedSizeprotected longsize
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractHttpData(String name, Charset charset, long size)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidcheckSize(long newSize)Check if the new size is not reaching the max limit allowed.io.netty.buffer.ByteBufcontent()protected voiddeallocate()longdefinedLength()Returns the defined length of the HttpData.CharsetgetCharset()Returns the Charset passed by the browser or null if not defined.longgetMaxSize()Returns the maxSize for this HttpData.StringgetName()Returns the name of this InterfaceHttpData.booleanisCompleted()longlength()Returns the size in byte of the InterfaceHttpDataHttpDataretain()HttpDataretain(int increment)voidsetCharset(Charset charset)Set the Charset passed by the browser if definedprotected voidsetCompleted()protected voidsetCompleted(boolean completed)voidsetMaxSize(long maxSize)Set the maxSize for this HttpData.abstract HttpDatatouch()abstract HttpDatatouch(Object hint)-
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
-
-
-
-
Method Detail
-
getMaxSize
public long getMaxSize()
Description copied from interface:HttpDataReturns the maxSize for this HttpData.- Specified by:
getMaxSizein interfaceHttpData
-
setMaxSize
public void setMaxSize(long maxSize)
Description copied from interface:HttpDataSet 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:
setMaxSizein interfaceHttpData
-
checkSize
public void checkSize(long newSize) throws IOExceptionDescription copied from interface:HttpDataCheck if the new size is not reaching the max limit allowed. The limit is always computed in terms of bytes.- Specified by:
checkSizein interfaceHttpData- Throws:
IOException
-
getName
public String getName()
Description copied from interface:InterfaceHttpDataReturns the name of this InterfaceHttpData.- Specified by:
getNamein interfaceInterfaceHttpData
-
isCompleted
public boolean isCompleted()
- Specified by:
isCompletedin interfaceHttpData- Returns:
- True if the InterfaceHttpData is completed (all data are stored)
-
setCompleted
protected void setCompleted()
-
setCompleted
protected void setCompleted(boolean completed)
-
getCharset
public Charset getCharset()
Description copied from interface:HttpDataReturns the Charset passed by the browser or null if not defined.- Specified by:
getCharsetin interfaceHttpData- Returns:
- the Charset passed by the browser or null if not defined.
-
setCharset
public void setCharset(Charset charset)
Description copied from interface:HttpDataSet the Charset passed by the browser if defined- Specified by:
setCharsetin interfaceHttpData- Parameters:
charset- Charset to set - must be not null
-
length
public long length()
Description copied from interface:HttpDataReturns the size in byte of the InterfaceHttpData
-
definedLength
public long definedLength()
Description copied from interface:HttpDataReturns 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 oneFileUploador any known bigAttribute.- Specified by:
definedLengthin interfaceHttpData- Returns:
- the defined length of the HttpData
-
content
public io.netty.buffer.ByteBuf content()
- Specified by:
contentin interfaceio.netty.buffer.ByteBufHolder
-
deallocate
protected void deallocate()
- Specified by:
deallocatein classio.netty.util.AbstractReferenceCounted
-
retain
public HttpData retain()
- Specified by:
retainin interfaceio.netty.buffer.ByteBufHolder- Specified by:
retainin interfaceHttpData- Specified by:
retainin interfaceInterfaceHttpData- Specified by:
retainin interfaceio.netty.util.ReferenceCounted- Overrides:
retainin classio.netty.util.AbstractReferenceCounted
-
retain
public HttpData retain(int increment)
- Specified by:
retainin interfaceio.netty.buffer.ByteBufHolder- Specified by:
retainin interfaceHttpData- Specified by:
retainin interfaceInterfaceHttpData- Specified by:
retainin interfaceio.netty.util.ReferenceCounted- Overrides:
retainin classio.netty.util.AbstractReferenceCounted
-
touch
public abstract HttpData touch()
- Specified by:
touchin interfaceio.netty.buffer.ByteBufHolder- Specified by:
touchin interfaceHttpData- Specified by:
touchin interfaceInterfaceHttpData- Specified by:
touchin interfaceio.netty.util.ReferenceCounted- Overrides:
touchin classio.netty.util.AbstractReferenceCounted
-
-