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
- ThisHttpData
type, forreturn (D) this
on 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
Modifier and TypeClassDescriptionfinal class
Chunk of bytes from this data object.static final class
Factory forMicronautHttpData
instances.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 TypeMethodDescriptionvoid
addContent
(io.netty.buffer.ByteBuf buffer, boolean last) void
checkSize
(long newSize) int
io.netty.buffer.ByteBuf
content()
copy()
protected void
long
void
delete()
byte[]
get()
io.netty.buffer.ByteBuf
io.netty.buffer.ByteBuf
getChunk
(int length) getFile()
long
getName()
boolean
boolean
long
length()
Get a chunk of data.boolean
replace
(io.netty.buffer.ByteBuf content) retain()
retain
(int increment) void
setCharset
(Charset charset) void
setContent
(io.netty.buffer.ByteBuf buffer) void
setContent
(File file) void
setContent
(InputStream inputStream) void
setMaxSize
(long maxSize) toStream()
touch()
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 io.netty.handler.codec.http.multipart.InterfaceHttpData
getHttpDataType
Methods 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
null
if this data iscompleted
and all chunks have been polled.
-
toStream
-
addContent
- Specified by:
addContent
in interfaceio.netty.handler.codec.http.multipart.HttpData
- Throws:
IOException
-
deallocate
protected void deallocate()- Specified by:
deallocate
in classio.netty.util.AbstractReferenceCounted
-
setContent
- Specified by:
setContent
in interfaceio.netty.handler.codec.http.multipart.HttpData
- Throws:
IOException
-
getMaxSize
public long getMaxSize()- Specified by:
getMaxSize
in interfaceio.netty.handler.codec.http.multipart.HttpData
-
setMaxSize
public void setMaxSize(long maxSize) - Specified by:
setMaxSize
in interfaceio.netty.handler.codec.http.multipart.HttpData
-
checkSize
- Specified by:
checkSize
in interfaceio.netty.handler.codec.http.multipart.HttpData
- Throws:
IOException
-
setContent
- Specified by:
setContent
in interfaceio.netty.handler.codec.http.multipart.HttpData
- Throws:
IOException
-
setContent
- Specified by:
setContent
in interfaceio.netty.handler.codec.http.multipart.HttpData
- Throws:
IOException
-
isCompleted
public boolean isCompleted()- Specified by:
isCompleted
in interfaceio.netty.handler.codec.http.multipart.HttpData
-
length
public long length()- Specified by:
length
in interfaceio.netty.handler.codec.http.multipart.HttpData
-
definedLength
public long definedLength()- Specified by:
definedLength
in interfaceio.netty.handler.codec.http.multipart.HttpData
-
delete
public void delete()- Specified by:
delete
in interfaceio.netty.handler.codec.http.multipart.HttpData
-
get
- Specified by:
get
in interfaceio.netty.handler.codec.http.multipart.HttpData
- Throws:
IOException
-
getByteBuf
public io.netty.buffer.ByteBuf getByteBuf()- Specified by:
getByteBuf
in interfaceio.netty.handler.codec.http.multipart.HttpData
-
getChunk
- Specified by:
getChunk
in interfaceio.netty.handler.codec.http.multipart.HttpData
- Throws:
IOException
-
getString
- Specified by:
getString
in interfaceio.netty.handler.codec.http.multipart.HttpData
- Throws:
IOException
-
getString
- Specified by:
getString
in interfaceio.netty.handler.codec.http.multipart.HttpData
- Throws:
IOException
-
setCharset
- Specified by:
setCharset
in interfaceio.netty.handler.codec.http.multipart.HttpData
-
getCharset
- Specified by:
getCharset
in interfaceio.netty.handler.codec.http.multipart.HttpData
-
renameTo
- Specified by:
renameTo
in interfaceio.netty.handler.codec.http.multipart.HttpData
- Throws:
IOException
-
isInMemory
public boolean isInMemory()- Specified by:
isInMemory
in interfaceio.netty.handler.codec.http.multipart.HttpData
-
getFile
- Specified by:
getFile
in interfaceio.netty.handler.codec.http.multipart.HttpData
- Throws:
IOException
-
content
public io.netty.buffer.ByteBuf content()- Specified by:
content
in interfaceio.netty.buffer.ByteBufHolder
-
copy
- Specified by:
copy
in interfaceio.netty.buffer.ByteBufHolder
- Specified by:
copy
in interfaceio.netty.handler.codec.http.multipart.HttpData
-
duplicate
- Specified by:
duplicate
in interfaceio.netty.buffer.ByteBufHolder
- Specified by:
duplicate
in interfaceio.netty.handler.codec.http.multipart.HttpData
-
retainedDuplicate
- Specified by:
retainedDuplicate
in interfaceio.netty.buffer.ByteBufHolder
- Specified by:
retainedDuplicate
in interfaceio.netty.handler.codec.http.multipart.HttpData
-
replace
- Specified by:
replace
in interfaceio.netty.buffer.ByteBufHolder
- Specified by:
replace
in interfaceio.netty.handler.codec.http.multipart.HttpData
-
getName
- Specified by:
getName
in interfaceio.netty.handler.codec.http.multipart.InterfaceHttpData
-
touch
- Specified by:
touch
in interfaceio.netty.buffer.ByteBufHolder
- Specified by:
touch
in interfaceio.netty.handler.codec.http.multipart.HttpData
- Specified by:
touch
in interfaceio.netty.handler.codec.http.multipart.InterfaceHttpData
- Specified by:
touch
in interfaceio.netty.util.ReferenceCounted
-
compareTo
- Specified by:
compareTo
in interfaceComparable<D extends io.netty.handler.codec.http.multipart.HttpData>
-
retain
- Specified by:
retain
in interfaceio.netty.buffer.ByteBufHolder
- Specified by:
retain
in interfaceio.netty.handler.codec.http.multipart.HttpData
- Specified by:
retain
in interfaceio.netty.handler.codec.http.multipart.InterfaceHttpData
- Specified by:
retain
in interfaceio.netty.util.ReferenceCounted
- Overrides:
retain
in classio.netty.util.AbstractReferenceCounted
-
retain
- Specified by:
retain
in interfaceio.netty.buffer.ByteBufHolder
- Specified by:
retain
in interfaceio.netty.handler.codec.http.multipart.HttpData
- Specified by:
retain
in interfaceio.netty.handler.codec.http.multipart.InterfaceHttpData
- Specified by:
retain
in interfaceio.netty.util.ReferenceCounted
- Overrides:
retain
in classio.netty.util.AbstractReferenceCounted
-
touch
- Specified by:
touch
in interfaceio.netty.buffer.ByteBufHolder
- Specified by:
touch
in interfaceio.netty.handler.codec.http.multipart.HttpData
- Specified by:
touch
in interfaceio.netty.handler.codec.http.multipart.InterfaceHttpData
- Specified by:
touch
in interfaceio.netty.util.ReferenceCounted
- Overrides:
touch
in classio.netty.util.AbstractReferenceCounted
-