Class Asn1Buffer2
- java.lang.Object
-
- org.apache.directory.api.asn1.util.Asn1Buffer2
-
public class Asn1Buffer2 extends Object
A buffer used to store an encoding PDU. It's auto-extended, and filled by the end.- Author:
- Apache Directory Project
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classAsn1Buffer2.InternalBufferThe internal buffer storage
-
Field Summary
Fields Modifier and Type Field Description private Asn1Buffer2.InternalBuffercurrentBufferThe current internal bufferprivate static intDEFAULT_SIZEThe buffer default sizeprivate intposThe current position in the bufferprivate intsizeThe current size
-
Constructor Summary
Constructors Constructor Description Asn1Buffer2()Create a new instance of Asn1Buffer2
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clear the position, emptying the buffer.private voidextend()Extend the bufferbyte[]getBytes()intgetPos()intgetSize()voidput(byte b)Store a byte at the current position in the buffervoidput(byte[] bytes)Store some bytes at the current position in the bufferStringtoString()
-
-
-
Field Detail
-
DEFAULT_SIZE
private static final int DEFAULT_SIZE
The buffer default size- See Also:
- Constant Field Values
-
pos
private int pos
The current position in the buffer
-
size
private int size
The current size
-
currentBuffer
private Asn1Buffer2.InternalBuffer currentBuffer
The current internal buffer
-
-
Method Detail
-
getPos
public int getPos()
- Returns:
- The current position in the buffer
-
put
public void put(byte b)
Store a byte at the current position in the buffer- Parameters:
b- The byte to store
-
put
public void put(byte[] bytes)
Store some bytes at the current position in the buffer- Parameters:
bytes- The bytes to store
-
extend
private void extend()
Extend the buffer
-
getBytes
public byte[] getBytes()
- Returns:
- The stored encoded PDU.
-
getSize
public int getSize()
- Returns:
- The buffer size (ie the maximum number of bytes that can be added to this buffer before it gets extended).
-
clear
public void clear()
Clear the position, emptying the buffer. If it has grown, reallocate it to its initial size.
-
-