Package org.ldaptive.transport.netty
Class NettyDERBuffer
java.lang.Object
org.ldaptive.transport.netty.NettyDERBuffer
- All Implemented Interfaces:
DERBuffer
DERBuffer
that uses a ByteBuf
. Since ByteBuf
does not have the concept of limit the writer
index is used to track the limit.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final io.netty.buffer.ByteBuf
Underlying byte buffer. -
Constructor Summary
ConstructorsConstructorDescriptionNettyDERBuffer
(io.netty.buffer.ByteBuf buf) Creates a new netty DER buffer.NettyDERBuffer
(io.netty.buffer.ByteBuf buf, int pos, int lim) Creates a new netty DER buffer and sets the initial position and limit. -
Method Summary
Modifier and TypeMethodDescriptionint
capacity()
Returns this buffer's capacity.clear()
Sets the position to zero and the limit to the capacity.byte
get()
Relative get method.get
(byte[] dst) Relative bulk get method.int
limit()
Returns this buffer's limit.limit
(int newLimit) Sets this buffer's limit.int
position()
Returns this buffer's position.position
(int newPosition) Sets this buffer's position.slice()
Creates a new DER buffer whose content is a shared sub-sequence of this buffer's content.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.ldaptive.asn1.DERBuffer
getRemainingBytes, hasRemaining, remaining
-
Field Details
-
buffer
private final io.netty.buffer.ByteBuf bufferUnderlying byte buffer.
-
-
Constructor Details
-
NettyDERBuffer
public NettyDERBuffer(io.netty.buffer.ByteBuf buf) Creates a new netty DER buffer.- Parameters:
buf
- existing byte buf
-
NettyDERBuffer
public NettyDERBuffer(io.netty.buffer.ByteBuf buf, int pos, int lim) Creates a new netty DER buffer and sets the initial position and limit.- Parameters:
buf
- existing byte bufpos
- initial buffer positionlim
- initial buffer limit
-
-
Method Details
-
position
public int position()Description copied from interface:DERBuffer
Returns this buffer's position. -
position
Description copied from interface:DERBuffer
Sets this buffer's position. -
limit
public int limit()Description copied from interface:DERBuffer
Returns this buffer's limit. -
capacity
public int capacity()Description copied from interface:DERBuffer
Returns this buffer's capacity. -
limit
Description copied from interface:DERBuffer
Sets this buffer's limit. -
clear
Description copied from interface:DERBuffer
Sets the position to zero and the limit to the capacity.This method does not actually erase the data in the buffer.
-
get
public byte get()Description copied from interface:DERBuffer
Relative get method. Reads the byte at this buffer's current position and then increments the position. -
get
Description copied from interface:DERBuffer
Relative bulk get method. -
slice
Description copied from interface:DERBuffer
Creates a new DER buffer whose content is a shared sub-sequence of this buffer's content.The content of the new buffer will start at this buffer's current position. Changes to this buffer's content will be visible in the new buffer, and vice versa; the two buffers' position and limit will be independent.
The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer.
-
toString
-