C# 클래스 HdrHistogram.Utilities.ByteBuffer

A byte buffer that tracks position and allows reads and writes of 32 and 64 bit integer values.
파일 보기 프로젝트 열기: HdrHistogram/HdrHistogram.NET 1 사용 예제들

공개 메소드들

메소드 설명
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