Package org.ldaptive.asn1
Class DefaultDERBuffer
java.lang.Object
org.ldaptive.asn1.DefaultDERBuffer
- All Implemented Interfaces:
DERBuffer
DERBuffer that uses a ByteBuffer.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultDERBuffer(byte[] array) Creates a new default DER buffer.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
Modifier and TypeMethodDescriptionintcapacity()Returns this buffer's capacity.clear()Sets the position to zero and the limit to the capacity.byteget()Relative get method.get(byte[] dst) Relative bulk get method.intlimit()Returns this buffer's limit.limit(int newLimit) Sets this buffer's limit.intposition()Returns this buffer's position.position(int newPosition) Sets this buffer's position.positionAndLimit(int newPosition, int newLimit) Sets this buffer's position and limit at the same time.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, waitMethods inherited from interface org.ldaptive.asn1.DERBuffer
getRemainingBytes, hasRemaining, remaining
-
Field Details
-
buffer
Underlying byte buffer.
-
-
Constructor Details
-
DefaultDERBuffer
public DefaultDERBuffer(byte[] array) Creates a new default DER buffer. SeeByteBuffer.wrap(byte[]).- Parameters:
array- contents of the buffer
-
DefaultDERBuffer
Creates a new default DER buffer.- Parameters:
buf- existing byte buffer
-
DefaultDERBuffer
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 Details
-
position
public int position()Description copied from interface:DERBufferReturns this buffer's position. -
position
Description copied from interface:DERBufferSets this buffer's position. -
limit
public int limit()Description copied from interface:DERBufferReturns this buffer's limit. -
capacity
public int capacity()Description copied from interface:DERBufferReturns this buffer's capacity. -
limit
Description copied from interface:DERBufferSets this buffer's limit. -
positionAndLimit
Description copied from interface:DERBufferSets this buffer's position and limit at the same time. Different buffer implementations may impose different constraints when moving both the position and limit indexes at the same time. Consequently, you may not be able to chain theDERBuffer.position(int)andDERBuffer.limit(int)methods correctly for all implementations.- Specified by:
positionAndLimitin interfaceDERBuffer- Parameters:
newPosition- The new position value; must be non-negative and no larger than the current limitnewLimit- The new limit value; must be non-negative and no larger than this buffer's capacity- Returns:
- This buffer
-
clear
Description copied from interface:DERBufferSets 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:DERBufferRelative get method. Reads the byte at this buffer's current position and then increments the position. -
get
Description copied from interface:DERBufferRelative bulk get method. -
slice
Description copied from interface:DERBufferCreates 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
-