DataBuffer interface that wraps a Netty 4
ByteBuf. Typically constructed with NettyDataBufferFactory.
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private ByteBuf | |
| private final NettyDataBufferFactory |
| Access | Constructor and Description |
|---|---|
| pack-priv | NettyDataBuffer(ByteBuf
the buffer to base this buffer on byteBuf, NettyDataBufferFactory dataBufferFactory)Create a new |
| Modifier and Type | Method and Description |
|---|---|
| public ByteBuffer | asByteBuffer()
Implements org.
Deprecated
Expose this buffer's bytes as a |
| public ByteBuffer | asByteBuffer(int
the index at which to start the byte buffer index, int the length of the returned byte buffer length)Implements org.
Deprecated
Expose a subsequence of this buffer's bytes as a |
| public int | capacity()
Implements org. Return the number of bytes that this buffer can contain. |
| public NettyDataBuffer | capacity(int
the new capacity capacity)Implements org.
Deprecated
Set the number of bytes that this buffer can contain. |
| public DataBuffer | ensureWritable(int
the writable capacity to check for capacity)Implements org. Ensure that the current buffer has enough |
| public boolean | equals(Object
the reference object with which to compare. other)Overrides java. Indicates whether some other object is "equal to" this one. |
| public NettyDataBufferFactory | factory()
Implements org. Return the |
| public byte | getByte(int
the index at which the byte will be read index)Implements org. Read a single byte at the given index from this data buffer. |
| public ByteBuf | Returns: the wrapped byte bufferDirectly exposes the native |
| public int | |
| private static boolean | |
| public int | indexOf(IntPredicate
the predicate to match predicate, int the index to start the search from fromIndex)Implements org. Return the index of the first byte in this buffer that matches the given predicate. |
| public boolean | isAllocated()
Implements org. Return |
| public int | lastIndexOf(IntPredicate
the predicate to match predicate, int the index to start the search from fromIndex)Implements org. Return the index of the last byte in this buffer that matches the given predicate. |
| public byte | read()
Implements org. Read a single byte from the current reading position from this data buffer. |
| public NettyDataBuffer | read(byte[]
the array into which the bytes are to be written destination)Implements org. Read this buffer's data into the specified destination, starting at the current reading position of this buffer. |
| public NettyDataBuffer | read(byte[]
the array into which the bytes are to be written destination, int the index within offset, int destination of the first byte to be writtenthe maximum number of bytes to be written in length)destinationImplements org. Read at most |
| public DataBuffer. | readableByteBuffers()
Implements org. Returns a closeable iterator over each |
| public int | readableByteCount()
Implements org. Return the number of bytes that can be read from this data buffer. |
| public int | readPosition()
Implements org. Return the position from which this buffer will read. |
| public NettyDataBuffer | readPosition(int
the new read position readPosition)Implements org. Set the position from which this buffer will read. |
| public boolean | release()
Implements org. Decrease the reference count for this buffer by one, and deallocate it once the count reaches zero. |
| public PooledDataBuffer | retain()
Implements org. Increase the reference count for this buffer by one. |
| public NettyDataBuffer | retainedSlice(int
the index at which to start the slice index, int the length of the slice length)Overrides default org.
Deprecated
Create a new |
| public NettyDataBuffer | slice(int
the index at which to start the slice index, int the length of the slice length)Implements org.
Deprecated
Create a new |
| public NettyDataBuffer | split(int
the index at which it should be split index)Implements org. Splits this data buffer into two at the given index. |
| public ByteBuffer | toByteBuffer(int index, int length)
Implements org.
Deprecated
Returns a |
| public void | toByteBuffer(int
the position of this data buffer from where copying should start srcPos, ByteBuffer the destination byte buffer dest, int the position in destPos, int dest to where copying should startthe amount of data to copy length)Implements org. Copies the given length from this data buffer into the given destination
|
| public String | toString(Charset
the character set to use charset)Overrides default org. Return this buffer's data a String using the specified charset. |
| public String | toString(int
the index at which to start the string index, int the number of bytes to use for the string length, Charset the charset to use charset)Implements org. Return a part of this buffer's data as a String using the specified charset. |
| public String | |
| public PooledDataBuffer | touch(Object hint)
Implements org. Associate the given hint with the data buffer for debugging purposes. |
| public DataBuffer. | writableByteBuffers()
Implements org. Returns a closeable iterator over each |
| public int | writableByteCount()
Implements org. Return the number of bytes that can be written to this data buffer. |
| public NettyDataBuffer | write(byte
the byte to be written b)Implements org. Write a single byte into this buffer at the current writing position. |
| public NettyDataBuffer | write(byte[]
the bytes to be written into this buffer source)Implements org. Write the given source into this buffer, starting at the current writing position of this buffer. |
| public NettyDataBuffer | write(byte[]
the bytes to be written into this buffer source, int the index within offset, int source to start writing fromthe maximum number of bytes to be written from length)sourceImplements org. Write at most |
| public NettyDataBuffer | write(DataBuffer...
the byte buffers to write into this buffer dataBuffers)Implements org. Write one or more |
| public NettyDataBuffer | write(ByteBuffer...
the byte buffers to write into this buffer buffers)Implements org. Write one or more |
| public NettyDataBuffer | |
| public DataBuffer | write(CharSequence
the char sequence to write into this buffer charSequence, Charset the charset to encode the char sequence with charset)Overrides default org. Write the given |
| public int | writePosition()
Implements org. Return the position to which this buffer will write. |
| public NettyDataBuffer | writePosition(int
the new write position writePosition)Implements org. Set the position to which this buffer will write. |
| byteBuf | back to summary |
|---|---|
| private ByteBuf byteBuf | |
| dataBufferFactory | back to summary |
|---|---|
| private final NettyDataBufferFactory dataBufferFactory | |
| NettyDataBuffer | back to summary |
|---|---|
| pack-priv NettyDataBuffer(ByteBuf byteBuf, NettyDataBufferFactory dataBufferFactory) Create a new
| |
| asByteBuffer | back to summary |
|---|---|
| public ByteBuffer asByteBuffer() Implements org. Doc from org. Deprecated
Expose this buffer's bytes as a
| |
| asByteBuffer | back to summary |
|---|---|
| public ByteBuffer asByteBuffer(int index, int length) Implements org. Doc from org. Deprecated
Expose a subsequence of this buffer's bytes as a
| |
| capacity | back to summary |
|---|---|
| public int capacity() Implements org. Doc from org. Return the number of bytes that this buffer can contain.
| |
| capacity | back to summary |
|---|---|
| public NettyDataBuffer capacity(int capacity) Implements org. Doc from org. Deprecated
Set the number of bytes that this buffer can contain. If the new capacity is lower than the current capacity, the contents of this buffer will be truncated. If the new capacity is higher than the current capacity, it will be expanded.
| |
| ensureWritable | back to summary |
|---|---|
| public DataBuffer ensureWritable(int capacity) Implements org. Doc from org. Ensure that the current buffer has enough
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object other) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| factory | back to summary |
|---|---|
| public NettyDataBufferFactory factory() Implements org. Doc from org. Return the
| |
| getByte | back to summary |
|---|---|
| public byte getByte(int index) Implements org. Doc from org. Read a single byte at the given index from this data buffer.
| |
| getNativeBuffer | back to summary |
|---|---|
| public ByteBuf getNativeBuffer() Directly exposes the native
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| hasNettyDataBuffers | back to summary |
|---|---|
| private static boolean hasNettyDataBuffers(DataBuffer[] buffers) | |
| indexOf | back to summary |
|---|---|
| public int indexOf(IntPredicate predicate, int fromIndex) Implements org. Doc from org. Return the index of the first byte in this buffer that matches the given predicate.
| |
| isAllocated | back to summary |
|---|---|
| public boolean isAllocated() Implements org. Doc from org. Return
| |
| lastIndexOf | back to summary |
|---|---|
| public int lastIndexOf(IntPredicate predicate, int fromIndex) Implements org. Doc from org. Return the index of the last byte in this buffer that matches the given predicate.
| |
| read | back to summary |
|---|---|
| public byte read() Implements org. Doc from org. Read a single byte from the current reading position from this data buffer.
| |
| read | back to summary |
|---|---|
| public NettyDataBuffer read(byte[] destination) Implements org. Doc from org. Read this buffer's data into the specified destination, starting at the current reading position of this buffer.
| |
| read | back to summary |
|---|---|
| public NettyDataBuffer read(byte[] destination, int offset, int length) Implements org. Doc from org. Read at most
| |
| readableByteBuffers | back to summary |
|---|---|
| public DataBuffer. Implements org. Doc from org. Returns a closeable iterator over each Note that the returned iterator must be used in a try-with-resources clause or explicitly closed.
| |
| readableByteCount | back to summary |
|---|---|
| public int readableByteCount() Implements org. Doc from org. Return the number of bytes that can be read from this data buffer.
| |
| readPosition | back to summary |
|---|---|
| public int readPosition() Implements org. Doc from org. Return the position from which this buffer will read.
| |
| readPosition | back to summary |
|---|---|
| public NettyDataBuffer readPosition(int readPosition) Implements org. Doc from org. Set the position from which this buffer will read.
| |
| release | back to summary |
|---|---|
| public boolean release() Implements org. Doc from org. Decrease the reference count for this buffer by one, and deallocate it once the count reaches zero.
| |
| retain | back to summary |
|---|---|
| public PooledDataBuffer retain() Implements org. Doc from org. Increase the reference count for this buffer by one.
| |
| retainedSlice | back to summary |
|---|---|
| public NettyDataBuffer retainedSlice(int index, int length) Overrides default org. Doc from org. Deprecated
Create a new Note that unlike
| |
| slice | back to summary |
|---|---|
| public NettyDataBuffer slice(int index, int length) Implements org. Doc from org. Deprecated
Create a new Note that this method will not call
| |
| split | back to summary |
|---|---|
| public NettyDataBuffer split(int index) Implements org. Doc from org. Splits this data buffer into two at the given index. Data that precedes the The read and
write position of the returned buffer are
truncated to fit within the buffers capacity if
necessary. The positions of this buffer are set to
| |
| toByteBuffer | back to summary |
|---|---|
| public ByteBuffer toByteBuffer(int index, int length) Implements org. Doc from org. Deprecated
Returns a
| |
| toByteBuffer | back to summary |
|---|---|
| public void toByteBuffer(int srcPos, ByteBuffer dest, int destPos, int length) Implements org. Doc from org. Copies the given length from this data buffer into the given destination
| |
| toString | back to summary |
|---|---|
| public String toString(Charset charset) Overrides default org. Doc from org. Return this buffer's data a String using the specified charset. Default implementation
delegates to | |
| toString | back to summary |
|---|---|
| public String toString(int index, int length, Charset charset) Implements org. Doc from org. Return a part of this buffer's data as a String using the specified charset. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
| touch | back to summary |
|---|---|
| public PooledDataBuffer touch(Object hint) Implements org. Doc from org. Associate the given hint with the data buffer for debugging purposes.
| |
| writableByteBuffers | back to summary |
|---|---|
| public DataBuffer. Implements org. Doc from org. Returns a closeable iterator over each Note that the returned iterator must be used in a try-with-resources clause or explicitly closed.
| |
| writableByteCount | back to summary |
|---|---|
| public int writableByteCount() Implements org. Doc from org. Return the number of bytes that can be written to this data buffer.
| |
| write | back to summary |
|---|---|
| public NettyDataBuffer write(byte b) Implements org. Doc from org. Write a single byte into this buffer at the current writing position.
| |
| write | back to summary |
|---|---|
| public NettyDataBuffer write(byte[] source) Implements org. Doc from org. Write the given source into this buffer, starting at the current writing position of this buffer.
| |
| write | back to summary |
|---|---|
| public NettyDataBuffer write(byte[] source, int offset, int length) Implements org. Doc from org. Write at most
| |
| write | back to summary |
|---|---|
| public NettyDataBuffer write(DataBuffer... dataBuffers) Implements org. Doc from org. Write one or more
| |
| write | back to summary |
|---|---|
| public NettyDataBuffer write(ByteBuffer... buffers) Implements org. Doc from org. Write one or more
| |
| write | back to summary |
|---|---|
| public NettyDataBuffer write(ByteBuf... byteBufs) Writes one or more Netty
| |
| write | back to summary |
|---|---|
| public DataBuffer write(CharSequence charSequence, Charset charset) Overrides default org. Doc from org. Write the given
| |
| writePosition | back to summary |
|---|---|
| public int writePosition() Implements org. Doc from org. Return the position to which this buffer will write.
| |
| writePosition | back to summary |
|---|---|
| public NettyDataBuffer writePosition(int writePosition) Implements org. Doc from org. Set the position to which this buffer will write.
| |
| Modifier and Type | Field and Description |
|---|---|
| private final ByteBuffer[] | |
| private int | |
| private final boolean |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | close()
Implements org. Closes this stream and releases any system resources associated with it. |
| public boolean | |
| public ByteBuffer |
| byteBuffers | back to summary |
|---|---|
| private final ByteBuffer[] byteBuffers | |
| cursor | back to summary |
|---|---|
| private int cursor | |
| readOnly | back to summary |
|---|---|
| private final boolean readOnly | |
| ByteBufferIterator | back to summary |
|---|---|
| public ByteBufferIterator(ByteBuffer[] byteBuffers, boolean readOnly) | |
| close | back to summary |
|---|---|
| public void close() Implements org. Doc from java. Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect. As noted in
| |
| hasNext | back to summary |
|---|---|
| public boolean hasNext() Implements java. Doc from java. Returns
| |
| next | back to summary |
|---|---|
| public ByteBuffer next() Implements java. Doc from java. Returns the next element in the iteration.
| |