Class ByteBuffer
A buffer for bytes.
A byte buffer can be created in either one of the following ways:
- Allocate(Int32) a new byte array and create a buffer based on it
- AllocateDirect(Int32) a memory block and create a direct buffer based on it
- Wrap(Byte[]) an existing byte array to create a new buffer
Inherited Members
Assembly: DistributedLucene.Net.dll
Syntax
public abstract class ByteBuffer : Buffer, IComparable<ByteBuffer>
Properties
Name | Description |
---|---|
Array | Returns the byte array which this buffer is based on, if there is one. |
ArrayOffset | Returns the offset of the byte array which this buffer is based on, if there is one. The offset is the index of the array which corresponds to the zero position of the buffer. |
HasArray | Indicates whether this buffer is based on a byte array and provides read/write access. |
IsDirect | Indicates whether this buffer is direct. |
Order | Returns the byte order used by this buffer when converting bytes from/to other primitive types. The default byte order of byte buffer is always BIG_ENDIAN. |
ProtectedArray | Child class implements this method to realize Array. |
ProtectedArrayOffset | Child class implements this method to realize ArrayOffset. |
ProtectedHasArray | Child class implements this method to realize HasArray. |
Methods
Name | Description |
---|---|
Allocate(Int32) | Creates a byte buffer based on a newly allocated byte array. |
AllocateDirect(Int32) | Creates a direct byte buffer based on a newly allocated memory block. (NOT IMPLEMENTED IN LUCENE.NET) |
AsInt64Buffer() | Returns a long buffer which is based on the remaining content of this byte buffer. The new buffer's position is zero, its limit and capacity is the number of remaining bytes divided by eight, and its mark is not set. The new buffer's read-only property and byte order are the same as this buffer's. The new buffer is direct if this byte buffer is direct. The new buffer shares its content with this buffer, which means either buffer's change of content will be visible to the other. The two buffer's position, limit and mark are independent. |
AsReadOnlyBuffer() | Returns a read-only buffer that shares its content with this buffer. The returned buffer is guaranteed to be a new instance, even if this buffer is read-only itself. The new buffer's position, limit, capacity and mark are the same as this buffer. The new buffer shares its content with this buffer, which means this buffer's change of content will be visible to the new buffer. The two buffer's position, limit and mark are independent. |
Compact() | Compacts this byte buffer. The remaining bytes will be moved to the head of the buffer, starting from position zero. Then the position is set to Remaining; the limit is set to capacity; the mark is cleared. |
CompareTo(ByteBuffer) | Compares the remaining bytes of this buffer to another byte buffer's remaining bytes. |
Duplicate() | Returns a duplicated buffer that shares its content with this buffer. The duplicated buffer's position, limit, capacity and mark are the same as this buffer's. The duplicated buffer's read-only property and byte order are the same as this buffer's too. The new buffer shares its content with this buffer, which means either buffer's change of content will be visible to the other. The two buffer's position, limit and mark are independent. |
Equals(Object) | Checks whether this byte buffer is equal to another object.
If |
Get() | Returns the byte at the current position and increases the position by 1. |
Get(Byte[]) | Reads bytes from the current position into the specified byte array and increases the position by the number of bytes read.
Calling this method has the same effect as
|
Get(Byte[], Int32, Int32) | Reads bytes from the current position into the specified byte array, starting at the specified offset, and increases the position by the number of bytes read. |
Get(Int32) | Returns the byte at the specified index and does not change the position. |
GetChar() | Returns the char at the current position and increases the position by 2. The 2 bytes starting at the current position are composed into a char according to the current byte order and returned. |
GetChar(Int32) | Returns the char at the specified index. The 2 bytes starting from the specified index are composed into a char according to the current byte order and returned. The position is not changed. |
GetDouble() | Returns the double at the current position and increases the position by 8. The 8 bytes starting from the current position are composed into a double according to the current byte order and returned. |
GetDouble(Int32) | Returns the
The 8 bytes starting at the specified index are composed into a |
GetHashCode() | Calculates this buffer's hash code from the remaining chars. The position, limit, capacity and mark don't affect the hash code. |
GetInt16() | Returns the
The 2 bytes starting at the current position are composed into a NOTE: This was getShort() in the JDK |
GetInt16(Int32) | Returns the
The 2 bytes starting at the specified index are composed into a NOTE: This was getShort() in the JDK |
GetInt32() | Returns the
The 4 bytes starting at the current position are composed into a NOTE: This was getInt() in the JDK |
GetInt32(Int32) | Returns the
The 4 bytes starting at the specified index are composed into a NOTE: This was getInt() in the JDK |
GetInt64() | Returns the
The 8 bytes starting at the current position are composed into a NOTE: This was getLong() in the JDK |
GetInt64(Int32) | Returns the
The 8 bytes starting at the specified index are composed into a NOTE: This was getLong() in the JDK |
GetSingle() | Returns the
The 4 bytes starting at the current position are composed into a NOTE: This was getFloat() in the JDK |
GetSingle(Int32) | Returns the
The 4 bytes starting at the specified index are composed into a NOTE: This was getFloat() in the JDK |
Put(ByteBuffer) | Writes all the remaining bytes of the |
Put(Byte) | Writes the given byte to the current position and increases the position by 1. |
Put(Byte[]) | Writes bytes in the given byte array to the current position and increases the position by the number of bytes written.
Calling this method has the same effect as
|
Put(Byte[], Int32, Int32) | Writes bytes in the given byte array, starting from the specified offset, to the current position and increases the position by the number of bytes written. |
Put(Int32, Byte) | Write a |
PutChar(Char) | Writes the given
The |
PutChar(Int32, Char) | Writes the given
The |
PutDouble(Double) | Writes the given
The |
PutDouble(Int32, Double) | Writes the given
The |
PutInt16(Int16) | Writes the given
The NOTE: This was putShort() in the JDK |
PutInt16(Int32, Int16) | Writes the given
The NOTE: This was putShort() in the JDK |
PutInt32(Int32) | Writes the given
The NOTE: This was putInt() in the JDK |
PutInt32(Int32, Int32) | Writes the given
The NOTE: This was putInt() in the JDK |
PutInt64(Int32, Int64) | Writes the given
The NOTE: This was putLong() in the JDK |
PutInt64(Int64) | Writes the given
The NOTE: This was putLong() in the JDK |
PutSingle(Int32, Single) | Writes the given
The NOTE: This was putSingle() in the JDK |
PutSingle(Single) | Writes the given
The NOTE: This was putSingle() in the JDK |
SetOrder(ByteOrder) | Sets the byte order of this buffer. |
Slice() | Returns a sliced buffer that shares its content with this buffer. The sliced buffer's capacity will be this buffer's Remaining, and it's zero position will correspond to this buffer's current position. The new buffer's position will be 0, limit will be its capacity, and its mark is cleared. The new buffer's read-only property and byte order are the same as this buffer's. The new buffer shares its content with this buffer, which means either buffer's change of content will be visible to the other. The two buffer's position, limit and mark are independent. |
ToString() | Returns a string representing the state of this byte buffer. |
Wrap(Byte[]) | Creates a new byte buffer by wrapping the given byte array.
Calling this method has the same effect as
|
Wrap(Byte[], Int32, Int32) | Creates a new byte buffer by wrapping the given byte array.
The new buffer's position will be |