java.lang.Object
io.helidon.webserver.ByteBufDataChunk
- All Implemented Interfaces:
DataChunk,Iterable<ByteBuffer>
A special DataChunk implementation based on Netty's buffers. This is used by
our Jersey SPI implementation to take advantage of Netty's buffer pooling.
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]bytes()static ByteBufDataChunkcreate(boolean flush, boolean readOnly, io.netty.buffer.ByteBuf... byteBufs) Creates an instance given an array ofByteBuf's.static ByteBufDataChunkcreate(boolean flush, boolean readOnly, Runnable releaseCallback, io.netty.buffer.ByteBuf... byteBufs) Creates an instance given an array ofByteBuf's.data()This method is needed for testing some of our examples.<T> T[]booleanflush()<T> booleanisBackedBy(Class<T> clazz) booleanbooleaniterator()voidrelease()intvoidwriteFuture(CompletableFuture<DataChunk> writeFuture) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.helidon.common.http.DataChunk
id, isFlushChunkMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
create
public static ByteBufDataChunk create(boolean flush, boolean readOnly, io.netty.buffer.ByteBuf... byteBufs) Creates an instance given an array ofByteBuf's.- Parameters:
flush- a signal that this chunk should be written and flushed from any cache if possiblereadOnly- marks this buffer as read onlybyteBufs- the data for this chunk. Should not be reused untilreleaseCallbackis used- Returns:
- new chunk
-
create
public static ByteBufDataChunk create(boolean flush, boolean readOnly, Runnable releaseCallback, io.netty.buffer.ByteBuf... byteBufs) Creates an instance given an array ofByteBuf's.- Parameters:
flush- a signal that this chunk should be written and flushed from any cache if possiblereadOnly- marks this buffer as read onlyreleaseCallback- a callback which is called when this chunk is completely processedbyteBufs- the data for this chunk. Should not be reused untilreleaseCallbackis used- Returns:
- new chunk
-
isBackedBy
- Specified by:
isBackedByin interfaceDataChunk
-
data
-
isReleased
public boolean isReleased()- Specified by:
isReleasedin interfaceDataChunk
-
flush
public boolean flush() -
isReadOnly
public boolean isReadOnly()- Specified by:
isReadOnlyin interfaceDataChunk
-
release
public void release() -
writeFuture
- Specified by:
writeFuturein interfaceDataChunk
-
writeFuture
- Specified by:
writeFuturein interfaceDataChunk
-
remaining
public int remaining() -
data
This method is needed for testing some of our examples. It bypasses the optimization for which this class was created. -
duplicate
-
bytes
public byte[] bytes() -
iterator
- Specified by:
iteratorin interfaceDataChunk- Specified by:
iteratorin interfaceIterable<ByteBuffer>
-