java.lang.Object
io.jooby.netty.buffer.NettyDataBuffer
- All Implemented Interfaces:
DataBuffer
,PooledDataBuffer
,TouchableDataBuffer
Implementation of the
DataBuffer
interface that wraps a Netty 4 ByteBuf
.
Typically constructed with NettyDataBufferFactory
.- Since:
- 5.0
- Author:
- Arjen Poutsma, Brian Clozel
-
Method Summary
Modifier and TypeMethodDescriptionint
capacity()
clear()
ensureWritable
(int capacity) boolean
factory()
byte
getByte
(int index) io.netty.buffer.ByteBuf
Directly exposes the nativeByteBuf
that this buffer is based on.int
hashCode()
int
indexOf
(IntPredicate predicate, int fromIndex) boolean
int
lastIndexOf
(IntPredicate predicate, int fromIndex) byte
read()
read
(byte[] destination) read
(byte[] destination, int offset, int length) int
int
readPosition
(int readPosition) boolean
release()
retain()
split
(int index) void
toByteBuffer
(int srcPos, ByteBuffer dest, int destPos, int length) toString()
int
write
(byte b) write
(byte[] source) write
(byte[] source, int offset, int length) write
(DataBuffer... dataBuffers) write
(io.netty.buffer.ByteBuf... byteBufs) Writes one or more NettyByteBufs
to this buffer, starting at the current writing position.write
(CharSequence charSequence, Charset charset) write
(ByteBuffer... buffers) int
writePosition
(int writePosition) Methods inherited from interface io.jooby.buffer.DataBuffer
asInputStream, asInputStream, asOutputStream, asWriter, asWriter, toByteBuffer, write
-
Method Details
-
getNativeBuffer
public io.netty.buffer.ByteBuf getNativeBuffer()Directly exposes the nativeByteBuf
that this buffer is based on.- Returns:
- the wrapped byte buffer
-
factory
- Specified by:
factory
in interfaceDataBuffer
-
indexOf
- Specified by:
indexOf
in interfaceDataBuffer
-
lastIndexOf
- Specified by:
lastIndexOf
in interfaceDataBuffer
-
readableByteCount
public int readableByteCount()- Specified by:
readableByteCount
in interfaceDataBuffer
-
writableByteCount
public int writableByteCount()- Specified by:
writableByteCount
in interfaceDataBuffer
-
readPosition
public int readPosition()- Specified by:
readPosition
in interfaceDataBuffer
-
readPosition
- Specified by:
readPosition
in interfaceDataBuffer
-
writePosition
public int writePosition()- Specified by:
writePosition
in interfaceDataBuffer
-
writePosition
- Specified by:
writePosition
in interfaceDataBuffer
-
getByte
public byte getByte(int index) - Specified by:
getByte
in interfaceDataBuffer
-
capacity
public int capacity()- Specified by:
capacity
in interfaceDataBuffer
-
duplicate
- Specified by:
duplicate
in interfaceDataBuffer
-
ensureWritable
- Specified by:
ensureWritable
in interfaceDataBuffer
-
read
public byte read()- Specified by:
read
in interfaceDataBuffer
-
read
- Specified by:
read
in interfaceDataBuffer
-
read
- Specified by:
read
in interfaceDataBuffer
-
write
- Specified by:
write
in interfaceDataBuffer
-
write
- Specified by:
write
in interfaceDataBuffer
-
write
- Specified by:
write
in interfaceDataBuffer
-
write
- Specified by:
write
in interfaceDataBuffer
-
write
- Specified by:
write
in interfaceDataBuffer
-
write
Writes one or more NettyByteBufs
to this buffer, starting at the current writing position.- Parameters:
byteBufs
- the buffers to write into this buffer- Returns:
- this buffer
-
write
- Specified by:
write
in interfaceDataBuffer
-
split
- Specified by:
split
in interfaceDataBuffer
-
toByteBuffer
- Specified by:
toByteBuffer
in interfaceDataBuffer
-
readableByteBuffers
- Specified by:
readableByteBuffers
in interfaceDataBuffer
-
writableByteBuffers
- Specified by:
writableByteBuffers
in interfaceDataBuffer
-
toString
- Specified by:
toString
in interfaceDataBuffer
-
toString
- Specified by:
toString
in interfaceDataBuffer
-
clear
- Specified by:
clear
in interfaceDataBuffer
-
isAllocated
public boolean isAllocated()- Specified by:
isAllocated
in interfacePooledDataBuffer
-
retain
- Specified by:
retain
in interfacePooledDataBuffer
-
touch
- Specified by:
touch
in interfacePooledDataBuffer
- Specified by:
touch
in interfaceTouchableDataBuffer
-
release
public boolean release()- Specified by:
release
in interfacePooledDataBuffer
-
equals
-
hashCode
public int hashCode() -
toString
-