Package org.ldaptive.asn1
Class DefaultDERBuffer
- java.lang.Object
-
- org.ldaptive.asn1.DefaultDERBuffer
-
- All Implemented Interfaces:
DERBuffer
public class DefaultDERBuffer extends Object implements DERBuffer
DERBuffer
that uses aByteBuffer
.
-
-
Field Summary
Fields Modifier and Type Field Description private ByteBuffer
buffer
Underlying byte buffer.
-
Constructor Summary
Constructors Constructor Description DefaultDERBuffer(byte[] array)
Creates a new default DER buffer.DefaultDERBuffer(int capacity)
Creates a new default DER buffer.DefaultDERBuffer(ByteBuffer buf)
Creates a new default DER buffer.DefaultDERBuffer(ByteBuffer buf, int pos, int lim)
Creates a new default DER buffer and sets the initial position and limit.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
capacity()
Returns this buffer's capacity.DERBuffer
clear()
Sets the position to zero and the limit to the capacity.byte
get()
Relative get method.DERBuffer
get(byte[] dst)
Relative bulk get method.int
limit()
Returns this buffer's limit.DERBuffer
limit(int newLimit)
Sets this buffer's limit.int
position()
Returns this buffer's position.DERBuffer
position(int newPosition)
Sets this buffer's position.DERBuffer
slice()
Creates a new DER buffer whose content is a shared sub-sequence of this buffer's content.String
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 Detail
-
buffer
private final ByteBuffer buffer
Underlying byte buffer.
-
-
Constructor Detail
-
DefaultDERBuffer
public DefaultDERBuffer(int capacity)
Creates a new default DER buffer. SeeByteBuffer.allocate(int)
.- Parameters:
capacity
- of this buffer
-
DefaultDERBuffer
public DefaultDERBuffer(byte[] array)
Creates a new default DER buffer. SeeByteBuffer.wrap(byte[])
.- Parameters:
array
- contents of the buffer
-
DefaultDERBuffer
public DefaultDERBuffer(ByteBuffer buf)
Creates a new default DER buffer.- Parameters:
buf
- existing byte buffer
-
DefaultDERBuffer
public DefaultDERBuffer(ByteBuffer buf, int pos, int lim)
Creates a new default DER buffer and sets the initial position and limit.- Parameters:
buf
- existing byte bufferpos
- initial buffer positionlim
- initial buffer limit
-
-
Method Detail
-
position
public int position()
Description copied from interface:DERBuffer
Returns this buffer's position.
-
position
public DERBuffer position(int newPosition)
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
public DERBuffer limit(int newLimit)
Description copied from interface:DERBuffer
Sets this buffer's limit.
-
clear
public DERBuffer 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
public DERBuffer get(byte[] dst)
Description copied from interface:DERBuffer
Relative bulk get method.
-
slice
public DERBuffer 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.
-
-