Package io.micronaut.servlet.http
Class ByteArrayByteBuffer<T>
java.lang.Object
io.micronaut.servlet.http.ByteArrayByteBuffer<T>
- Type Parameters:
T
-
- All Implemented Interfaces:
io.micronaut.core.io.buffer.ByteBuffer<T>
@Internal
public class ByteArrayByteBuffer<T>
extends Object
implements io.micronaut.core.io.buffer.ByteBuffer<T>
A
ByteBuffer
implementation that is backed by a byte array.-
Constructor Summary
ConstructorDescriptionByteArrayByteBuffer
(byte[] underlyingBytes) Construct a newByteArrayByteBuffer
for the given bytes.ByteArrayByteBuffer
(byte[] underlyingBytes, int capacity) Construct a newByteArrayByteBuffer
for the given bytes and capacity. -
Method Summary
Modifier and TypeMethodDescriptionasNioBuffer
(int index, int length) io.micronaut.core.io.buffer.ByteBuffer
capacity
(int capacity) byte
getByte
(int index) int
indexOf
(byte b) int
byte
read()
io.micronaut.core.io.buffer.ByteBuffer
read
(byte[] destination) io.micronaut.core.io.buffer.ByteBuffer
read
(byte[] destination, int offset, int length) int
readCharSequence
(int length, Charset charset) int
io.micronaut.core.io.buffer.ByteBuffer
readerIndex
(int readPosition) io.micronaut.core.io.buffer.ByteBuffer
slice
(int index, int length) byte[]
int
io.micronaut.core.io.buffer.ByteBuffer
write
(byte b) io.micronaut.core.io.buffer.ByteBuffer
write
(byte[] source) io.micronaut.core.io.buffer.ByteBuffer
write
(byte[] source, int offset, int length) io.micronaut.core.io.buffer.ByteBuffer
write
(io.micronaut.core.io.buffer.ByteBuffer... buffers) io.micronaut.core.io.buffer.ByteBuffer
write
(CharSequence source, Charset charset) io.micronaut.core.io.buffer.ByteBuffer
write
(ByteBuffer... buffers) int
io.micronaut.core.io.buffer.ByteBuffer
writerIndex
(int position)
-
Constructor Details
-
ByteArrayByteBuffer
public ByteArrayByteBuffer(byte[] underlyingBytes) Construct a newByteArrayByteBuffer
for the given bytes.- Parameters:
underlyingBytes
- the bytes to wrap
-
ByteArrayByteBuffer
public ByteArrayByteBuffer(byte[] underlyingBytes, int capacity) Construct a newByteArrayByteBuffer
for the given bytes and capacity. If capacity is greater than the length of the underlyingBytes, extra bytes will be zeroed out. If capacity is less than the length of the underlyingBytes, the underlyingBytes will be truncated.- Parameters:
underlyingBytes
- the bytes to wrapcapacity
- the capacity of the buffer
-
-
Method Details
-
asNativeBuffer
- Specified by:
asNativeBuffer
in interfaceio.micronaut.core.io.buffer.ByteBuffer<T>
-
readableBytes
public int readableBytes()- Specified by:
readableBytes
in interfaceio.micronaut.core.io.buffer.ByteBuffer<T>
-
writableBytes
public int writableBytes()- Specified by:
writableBytes
in interfaceio.micronaut.core.io.buffer.ByteBuffer<T>
-
maxCapacity
public int maxCapacity()- Specified by:
maxCapacity
in interfaceio.micronaut.core.io.buffer.ByteBuffer<T>
-
capacity
public io.micronaut.core.io.buffer.ByteBuffer capacity(int capacity) - Specified by:
capacity
in interfaceio.micronaut.core.io.buffer.ByteBuffer<T>
-
readerIndex
public int readerIndex()- Specified by:
readerIndex
in interfaceio.micronaut.core.io.buffer.ByteBuffer<T>
-
readerIndex
public io.micronaut.core.io.buffer.ByteBuffer readerIndex(int readPosition) - Specified by:
readerIndex
in interfaceio.micronaut.core.io.buffer.ByteBuffer<T>
-
writerIndex
public int writerIndex()- Specified by:
writerIndex
in interfaceio.micronaut.core.io.buffer.ByteBuffer<T>
-
writerIndex
public io.micronaut.core.io.buffer.ByteBuffer writerIndex(int position) - Specified by:
writerIndex
in interfaceio.micronaut.core.io.buffer.ByteBuffer<T>
-
read
public byte read()- Specified by:
read
in interfaceio.micronaut.core.io.buffer.ByteBuffer<T>
-
readCharSequence
- Specified by:
readCharSequence
in interfaceio.micronaut.core.io.buffer.ByteBuffer<T>
-
read
public io.micronaut.core.io.buffer.ByteBuffer read(byte[] destination) - Specified by:
read
in interfaceio.micronaut.core.io.buffer.ByteBuffer<T>
-
read
public io.micronaut.core.io.buffer.ByteBuffer read(byte[] destination, int offset, int length) - Specified by:
read
in interfaceio.micronaut.core.io.buffer.ByteBuffer<T>
-
write
public io.micronaut.core.io.buffer.ByteBuffer write(byte b) - Specified by:
write
in interfaceio.micronaut.core.io.buffer.ByteBuffer<T>
-
write
public io.micronaut.core.io.buffer.ByteBuffer write(byte[] source) - Specified by:
write
in interfaceio.micronaut.core.io.buffer.ByteBuffer<T>
-
write
- Specified by:
write
in interfaceio.micronaut.core.io.buffer.ByteBuffer<T>
-
write
public io.micronaut.core.io.buffer.ByteBuffer write(byte[] source, int offset, int length) - Specified by:
write
in interfaceio.micronaut.core.io.buffer.ByteBuffer<T>
-
write
public io.micronaut.core.io.buffer.ByteBuffer write(io.micronaut.core.io.buffer.ByteBuffer... buffers) - Specified by:
write
in interfaceio.micronaut.core.io.buffer.ByteBuffer<T>
-
write
- Specified by:
write
in interfaceio.micronaut.core.io.buffer.ByteBuffer<T>
-
slice
public io.micronaut.core.io.buffer.ByteBuffer slice(int index, int length) - Specified by:
slice
in interfaceio.micronaut.core.io.buffer.ByteBuffer<T>
-
asNioBuffer
- Specified by:
asNioBuffer
in interfaceio.micronaut.core.io.buffer.ByteBuffer<T>
-
asNioBuffer
- Specified by:
asNioBuffer
in interfaceio.micronaut.core.io.buffer.ByteBuffer<T>
-
toInputStream
- Specified by:
toInputStream
in interfaceio.micronaut.core.io.buffer.ByteBuffer<T>
-
toOutputStream
- Specified by:
toOutputStream
in interfaceio.micronaut.core.io.buffer.ByteBuffer<T>
-
toByteArray
public byte[] toByteArray()- Specified by:
toByteArray
in interfaceio.micronaut.core.io.buffer.ByteBuffer<T>
-
toString
- Specified by:
toString
in interfaceio.micronaut.core.io.buffer.ByteBuffer<T>
-
indexOf
public int indexOf(byte b) - Specified by:
indexOf
in interfaceio.micronaut.core.io.buffer.ByteBuffer<T>
-
getByte
public byte getByte(int index) - Specified by:
getByte
in interfaceio.micronaut.core.io.buffer.ByteBuffer<T>
-