Class ByteBuffer
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
intthe 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
intthe offset of the provided buffer.
length
intthe length of valid bytes in the array
ByteBuffer(Stream)
Loads the stream into a buffer.
public ByteBuffer(Stream @in)
Parameters
in
Streaman InputStream
ByteBuffer(int)
public ByteBuffer(int initialCapacity)
Parameters
initialCapacity
intthe initial capacity for this buffer
Methods
Append(byte)
Appends a byte to the buffer.
public virtual void Append(byte b)
Parameters
b
bytea 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
intis a position of the first element to copy
len
intthe 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
ByteBufferanother
ByteBuffer
ByteAt(int)
public virtual byte ByteAt(int index)
Parameters
index
intthe index to retrieve the byte from
Returns
- byte
Returns a byte from the buffer
CharAt(int)
public virtual int CharAt(int index)
Parameters
index
intthe 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.