Package io.micronaut.http.server.netty
Class MicronautHttpData<D extends io.netty.handler.codec.http.multipart.HttpData>
java.lang.Object
io.netty.util.AbstractReferenceCounted
io.micronaut.http.server.netty.MicronautHttpData<D>
- Type Parameters:
D- ThisHttpDatatype, forreturn (D) thison various methods
- All Implemented Interfaces:
io.netty.buffer.ByteBufHolder,io.netty.handler.codec.http.multipart.HttpData,io.netty.handler.codec.http.multipart.InterfaceHttpData,io.netty.util.ReferenceCounted,Comparable<io.netty.handler.codec.http.multipart.InterfaceHttpData>
@Internal
public abstract sealed class MicronautHttpData<D extends io.netty.handler.codec.http.multipart.HttpData>
extends io.netty.util.AbstractReferenceCounted
implements io.netty.handler.codec.http.multipart.HttpData
Alternate
In most cases, we only access the
This class moves data to disk dynamically once the configured threshold is reached.
HttpData implementation with some limited concurrency support. Only implements
the features we actually need.In most cases, we only access the
HttpData on a single thread, with the standard
get() and friends. However, if the user wants a reactive stream of data as it comes in,
this class can release chunks of that data for concurrent access by the user (see
pollChunk()).This class moves data to disk dynamically once the configured threshold is reached.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionfinal classChunk of bytes from this data object.static final classFactory forMicronautHttpDatainstances.Nested classes/interfaces inherited from interface io.netty.handler.codec.http.multipart.InterfaceHttpData
io.netty.handler.codec.http.multipart.InterfaceHttpData.HttpDataType -
Method Summary
Modifier and TypeMethodDescriptionvoidaddContent(io.netty.buffer.ByteBuf buffer, boolean last) voidcheckSize(long newSize) intio.netty.buffer.ByteBufcontent()copy()protected voidlongvoiddelete()byte[]get()io.netty.buffer.ByteBufio.netty.buffer.ByteBufgetChunk(int length) getFile()longgetName()booleanbooleanlonglength()Get a chunk of data.booleanreplace(io.netty.buffer.ByteBuf content) retain()retain(int increment) voidsetCharset(Charset charset) voidsetContent(io.netty.buffer.ByteBuf buffer) voidsetContent(File file) voidsetContent(InputStream inputStream) voidsetMaxSize(long maxSize) toStream()touch()Methods inherited from class io.netty.util.AbstractReferenceCounted
refCnt, release, release, setRefCntMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.netty.handler.codec.http.multipart.InterfaceHttpData
getHttpDataTypeMethods inherited from interface io.netty.util.ReferenceCounted
refCnt, release, release
-
Method Details
-
pollChunk
Get a chunk of data. The chunk will have a fixed content, it will not be amended with further input.- Returns:
- The chunk, or
nullif this data iscompletedand all chunks have been polled.
-
toStream
-
addContent
- Specified by:
addContentin interfaceio.netty.handler.codec.http.multipart.HttpData- Throws:
IOException
-
deallocate
protected void deallocate()- Specified by:
deallocatein classio.netty.util.AbstractReferenceCounted
-
setContent
- Specified by:
setContentin interfaceio.netty.handler.codec.http.multipart.HttpData- Throws:
IOException
-
getMaxSize
public long getMaxSize()- Specified by:
getMaxSizein interfaceio.netty.handler.codec.http.multipart.HttpData
-
setMaxSize
public void setMaxSize(long maxSize) - Specified by:
setMaxSizein interfaceio.netty.handler.codec.http.multipart.HttpData
-
checkSize
- Specified by:
checkSizein interfaceio.netty.handler.codec.http.multipart.HttpData- Throws:
IOException
-
setContent
- Specified by:
setContentin interfaceio.netty.handler.codec.http.multipart.HttpData- Throws:
IOException
-
setContent
- Specified by:
setContentin interfaceio.netty.handler.codec.http.multipart.HttpData- Throws:
IOException
-
isCompleted
public boolean isCompleted()- Specified by:
isCompletedin interfaceio.netty.handler.codec.http.multipart.HttpData
-
length
public long length()- Specified by:
lengthin interfaceio.netty.handler.codec.http.multipart.HttpData
-
definedLength
public long definedLength()- Specified by:
definedLengthin interfaceio.netty.handler.codec.http.multipart.HttpData
-
delete
public void delete()- Specified by:
deletein interfaceio.netty.handler.codec.http.multipart.HttpData
-
get
- Specified by:
getin interfaceio.netty.handler.codec.http.multipart.HttpData- Throws:
IOException
-
getByteBuf
public io.netty.buffer.ByteBuf getByteBuf()- Specified by:
getByteBufin interfaceio.netty.handler.codec.http.multipart.HttpData
-
getChunk
- Specified by:
getChunkin interfaceio.netty.handler.codec.http.multipart.HttpData- Throws:
IOException
-
getString
- Specified by:
getStringin interfaceio.netty.handler.codec.http.multipart.HttpData- Throws:
IOException
-
getString
- Specified by:
getStringin interfaceio.netty.handler.codec.http.multipart.HttpData- Throws:
IOException
-
setCharset
- Specified by:
setCharsetin interfaceio.netty.handler.codec.http.multipart.HttpData
-
getCharset
- Specified by:
getCharsetin interfaceio.netty.handler.codec.http.multipart.HttpData
-
renameTo
- Specified by:
renameToin interfaceio.netty.handler.codec.http.multipart.HttpData- Throws:
IOException
-
isInMemory
public boolean isInMemory()- Specified by:
isInMemoryin interfaceio.netty.handler.codec.http.multipart.HttpData
-
getFile
- Specified by:
getFilein interfaceio.netty.handler.codec.http.multipart.HttpData- Throws:
IOException
-
content
public io.netty.buffer.ByteBuf content()- Specified by:
contentin interfaceio.netty.buffer.ByteBufHolder
-
copy
- Specified by:
copyin interfaceio.netty.buffer.ByteBufHolder- Specified by:
copyin interfaceio.netty.handler.codec.http.multipart.HttpData
-
duplicate
- Specified by:
duplicatein interfaceio.netty.buffer.ByteBufHolder- Specified by:
duplicatein interfaceio.netty.handler.codec.http.multipart.HttpData
-
retainedDuplicate
- Specified by:
retainedDuplicatein interfaceio.netty.buffer.ByteBufHolder- Specified by:
retainedDuplicatein interfaceio.netty.handler.codec.http.multipart.HttpData
-
replace
- Specified by:
replacein interfaceio.netty.buffer.ByteBufHolder- Specified by:
replacein interfaceio.netty.handler.codec.http.multipart.HttpData
-
getName
- Specified by:
getNamein interfaceio.netty.handler.codec.http.multipart.InterfaceHttpData
-
touch
- Specified by:
touchin interfaceio.netty.buffer.ByteBufHolder- Specified by:
touchin interfaceio.netty.handler.codec.http.multipart.HttpData- Specified by:
touchin interfaceio.netty.handler.codec.http.multipart.InterfaceHttpData- Specified by:
touchin interfaceio.netty.util.ReferenceCounted
-
compareTo
- Specified by:
compareToin interfaceComparable<D extends io.netty.handler.codec.http.multipart.HttpData>
-
retain
- Specified by:
retainin interfaceio.netty.buffer.ByteBufHolder- Specified by:
retainin interfaceio.netty.handler.codec.http.multipart.HttpData- Specified by:
retainin interfaceio.netty.handler.codec.http.multipart.InterfaceHttpData- Specified by:
retainin interfaceio.netty.util.ReferenceCounted- Overrides:
retainin classio.netty.util.AbstractReferenceCounted
-
retain
- Specified by:
retainin interfaceio.netty.buffer.ByteBufHolder- Specified by:
retainin interfaceio.netty.handler.codec.http.multipart.HttpData- Specified by:
retainin interfaceio.netty.handler.codec.http.multipart.InterfaceHttpData- Specified by:
retainin interfaceio.netty.util.ReferenceCounted- Overrides:
retainin classio.netty.util.AbstractReferenceCounted
-
touch
- Specified by:
touchin interfaceio.netty.buffer.ByteBufHolder- Specified by:
touchin interfaceio.netty.handler.codec.http.multipart.HttpData- Specified by:
touchin interfaceio.netty.handler.codec.http.multipart.InterfaceHttpData- Specified by:
touchin interfaceio.netty.util.ReferenceCounted- Overrides:
touchin classio.netty.util.AbstractReferenceCounted
-