C# Класс HdrHistogram.Utilities.ByteBuffer

A byte buffer that tracks position and allows reads and writes of 32 and 64 bit integer values.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
Allocate ( byte source ) : ByteBuffer

Creates a ByteBuffer loaded with the provided byte array.

Allocate ( int bufferCapacity ) : ByteBuffer

Creates a ByteBuffer with a specified capacity in bytes.

Capacity ( ) : int

Returns the capacity of the ByteBuffer

Get ( ) : byte

Gets the current byte and advances the position by one.

GetDouble ( ) : double

Gets the double floating point number (double) at the current position, and then advances by eight.

GetInt ( ) : int

Gets the 32 bit integer (int) at the current position, and then advances by four.

GetLong ( ) : long

Gets the 64 bit integer (long) at the current position, and then advances by eight.

GetShort ( ) : short

Gets the 16 bit integer (short) at the current position, and then advances by two.

Put ( byte value ) : void

Writes a byte value to the current position, and advances the position by one.

PutDouble ( double value ) : void

Sets the bytes at the current position to the value of the passed value, and advances the position.

PutInt ( int value ) : void

Sets the bytes at the current position to the value of the passed value, and advances the position.

PutInt ( int index, int value ) : void

Sets the bytes at the provided position to the value of the passed value, and does not advance the position.

This can be useful for writing a value into an earlier placeholder e.g. a header property for storing the body length.

PutLong ( long value ) : void

Sets the bytes at the current position to the value of the passed value, and advances the position.

ReadFrom ( System source, int length ) : int

Reads from the provided System.IO.Stream, into the buffer.

Remaining ( ) : int

The remaining capacity.

Приватные методы

Метод Описание
BlockCopy ( Array src, int srcOffset, int dstOffset, int count ) : void
BlockGet ( Array target, int targetOffset, int sourceOffset, int count ) : void
ByteBuffer ( int bufferCapacity ) : System
CheckByteArgument ( byte value, int startIndex, int bytesRequired ) : void

Checks the given argument for validity.

CheckedFromBytes ( byte value, int startIndex, int bytesToConvert ) : long

Checks the arguments for validity before calling FromBytes (which can therefore assume the arguments are valid).

FromBytes ( byte buffer, int startIndex, int bytesToConvert ) : long

Returns a value built from the specified number of bytes from the given buffer, starting at index.

Int64BitsToDouble ( long value ) : double

Converts the specified 64-bit signed integer to a double-precision floating point number. Note: the endianness of this converter does not affect the returned value.

ToArray ( ) : byte[]

Gets a copy of the internal byte array.

ToInt64 ( byte value, int startIndex ) : long

Returns a 64-bit signed integer converted from eight bytes at a specified position in a byte array.

Описание методов

Allocate() публичный статический Метод

Creates a ByteBuffer loaded with the provided byte array.
public static Allocate ( byte source ) : ByteBuffer
source byte The source byte array to load the buffer with.
Результат ByteBuffer

Allocate() публичный статический Метод

Creates a ByteBuffer with a specified capacity in bytes.
public static Allocate ( int bufferCapacity ) : ByteBuffer
bufferCapacity int The capacity of the buffer in bytes
Результат ByteBuffer

Capacity() публичный Метод

Returns the capacity of the ByteBuffer
public Capacity ( ) : int
Результат int

Get() публичный Метод

Gets the current byte and advances the position by one.
public Get ( ) : byte
Результат byte

GetDouble() публичный Метод

Gets the double floating point number (double) at the current position, and then advances by eight.
public GetDouble ( ) : double
Результат double

GetInt() публичный Метод

Gets the 32 bit integer (int) at the current position, and then advances by four.
public GetInt ( ) : int
Результат int

GetLong() публичный Метод

Gets the 64 bit integer (long) at the current position, and then advances by eight.
public GetLong ( ) : long
Результат long

GetShort() публичный Метод

Gets the 16 bit integer (short) at the current position, and then advances by two.
public GetShort ( ) : short
Результат short

Put() публичный Метод

Writes a byte value to the current position, and advances the position by one.
public Put ( byte value ) : void
value byte The byte value to write.
Результат void

PutDouble() публичный Метод

Sets the bytes at the current position to the value of the passed value, and advances the position.
public PutDouble ( double value ) : void
value double The value to set the current position to.
Результат void

PutInt() публичный Метод

Sets the bytes at the current position to the value of the passed value, and advances the position.
public PutInt ( int value ) : void
value int The value to set the current position to.
Результат void

PutInt() публичный Метод

Sets the bytes at the provided position to the value of the passed value, and does not advance the position.
This can be useful for writing a value into an earlier placeholder e.g. a header property for storing the body length.
public PutInt ( int index, int value ) : void
index int The position to set the value at.
value int The value to set.
Результат void

PutLong() публичный Метод

Sets the bytes at the current position to the value of the passed value, and advances the position.
public PutLong ( long value ) : void
value long The value to set the current position to.
Результат void

ReadFrom() публичный Метод

Reads from the provided System.IO.Stream, into the buffer.
public ReadFrom ( System source, int length ) : int
source System The source stream to read from.
length int The number of bytes to read.
Результат int

Remaining() публичный Метод

The remaining capacity.
public Remaining ( ) : int
Результат int