Table of Contents

Class ByteBuffer

Namespace
iText.Kernel.XMP.Impl
Assembly
itext.kernel.dll

Byte buffer container including length of valid data.

public class ByteBuffer
Inheritance
ByteBuffer
Inherited Members

Constructors

ByteBuffer(byte[])

public ByteBuffer(byte[] buffer)

Parameters

buffer byte[]

a byte array that will be wrapped with ByteBuffer.

ByteBuffer(byte[], int)

public ByteBuffer(byte[] buffer, int length)

Parameters

buffer byte[]

a byte array that will be wrapped with ByteBuffer.

length int

the length of valid bytes in the array

ByteBuffer(byte[], int, int)

public ByteBuffer(byte[] buffer, int offset, int length)

Parameters

buffer byte[]

a byte array that will be wrapped with ByteBuffer.

offset int

the offset of the provided buffer.

length int

the length of valid bytes in the array

ByteBuffer(Stream)

Loads the stream into a buffer.

public ByteBuffer(Stream @in)

Parameters

in Stream

an InputStream

ByteBuffer(int)

public ByteBuffer(int initialCapacity)

Parameters

initialCapacity int

the initial capacity for this buffer

Methods

Append(byte)

Appends a byte to the buffer.

public virtual void Append(byte b)

Parameters

b byte

a byte

Append(byte[])

Append a byte array to the buffer

public virtual void Append(byte[] bytes)

Parameters

bytes byte[]

a byte array

Append(byte[], int, int)

Appends a part of byte array to the buffer.

public virtual void Append(byte[] bytes, int offset, int len)

Parameters

bytes byte[]

a byte array

offset int

is a position of the first element to copy

len int

the number of array elements to be added

Remarks

Appends a part of byte array to the buffer. Elements on positions offset through offset+len-1 of provided array will be copied

Append(ByteBuffer)

Append another buffer to this buffer.

public virtual void Append(ByteBuffer anotherBuffer)

Parameters

anotherBuffer ByteBuffer

another ByteBuffer

ByteAt(int)

public virtual byte ByteAt(int index)

Parameters

index int

the index to retrieve the byte from

Returns

byte

Returns a byte from the buffer

CharAt(int)

public virtual int CharAt(int index)

Parameters

index int

the index to retrieve a byte as int or char.

Returns

int

Returns a byte from the buffer

GetByteStream()

public virtual Stream GetByteStream()

Returns

Stream

Returns a byte stream that is limited to the valid amount of bytes.

GetEncoding()

Detects the encoding of the byte buffer, stores and returns it.

public virtual string GetEncoding()

Returns

string

Returns the encoding string.

Remarks

Detects the encoding of the byte buffer, stores and returns it. Only UTF-8, UTF-16LE/BE and UTF-32LE/BE are recognized. Note: UTF-32 flavors are not supported by Java, the XML-parser will complain.

Length()

public virtual int Length()

Returns

int

Returns the length, that means the number of valid bytes, of the buffer; the inner byte array might be bigger than that.