C# 클래스 NewTOAPIA.BufferChunk

상속: IDisposable, ICloneable
파일 보기 프로젝트 열기: Wiladams/NewTOAPIA 1 사용 예제들

Private Properties

프로퍼티 타입 설명
BufferChunk System
ValidateIntPtr void
ValidateNonNegative void
ValidateNotZeroLength void
ValidateObject void
ValidatePointerData void
ValidateSufficientData void
ValidateSufficientSpace void
_GetFloat float
_GetInt16 Int16
_GetInt32 Int32
_GetUInt64 UInt64
_SetFloat void
_SetInt16 void
_SetInt32 void
_SetUInt64 void

공개 메소드들

메소드 설명
BufferChunk ( byte buffer ) : System

Constructor, create a BufferChunk using an existing byte[] without performing a memcopy

BufferChunk ( byte buffer, int index, int length ) : System

Constructor, create a BufferChunk from its constituent parts

BufferChunk ( int size ) : System

Constructor, create a new BufferChunk and allocate a new byte[] to hold the data.

Clear ( ) : void

Used to zero out the data area of the BufferChunk.

Clone ( ) : object

Creates a shallow copy (new Index and Length, duplicate reference to the same Buffer) of a BufferChunk.

Compare ( byte obj1, byte obj2 ) : bool
Copy ( byte source ) : byte[]
CopyFrom ( IntPtr source, Int32 alength ) : void
CopyTo ( BufferChunk destination, int index ) : void

Copy the valid data section of 'this' to the destination BufferChunk overwriting dest's previous contents This method does not allow dest's valid data section to grow or shrink (i.e. treat valid data as a fixed buffer)

CopyTo ( IntPtr destination, Int32 length ) : void
Dispose ( ) : void

Disposes the internal state of the object

GetByte ( int index ) : byte

Retrieves 1 byte from inside the BufferChunk This method is included for consistency. It simply forwards to the indexer.

GetDouble ( int index ) : double
GetFloat ( int index ) : float
GetInt16 ( int index ) : Int16

Retrieves 2 bytes inside the BufferChunk

GetInt32 ( int index ) : int

Retrieves 4 bytes inside the BufferChunk

GetInt64 ( int index ) : long

Retrieves 8 bytes inside the BufferChunk

GetPaddedUInt16 ( int index ) : UInt16
GetPaddedUInt32 ( int index ) : UInt32
GetPaddedUInt64 ( int index ) : UInt64
GetUInt16 ( int index ) : UInt16

Retrieves 2 bytes inside the BufferChunk

GetUInt32 ( int index ) : UInt32

Retrieves 4 bytes inside the BufferChunk

GetUInt64 ( int index ) : UInt64

Retrieves 8 bytes inside the BufferChunk

GetUTF8String ( int index, int length ) : string

Retrieves length bytes from inside the BufferChunk and converts from UTF8 string

NextBufferChunk ( int length ) : BufferChunk

Returns a BufferChunk consisting of the next 'length' bytes of the BufferChunk instance. Automatically increments Index and decrements Length. This function is useful for iterative functions that parse through a large BufferChunk returning smaller BufferChunks

NextBufferChunkMax ( int length ) : BufferChunk

Returns the requested amount of data, or whatever remains if length > this.length

NextByte ( ) : byte
NextDouble ( ) : double
NextFloat ( ) : float
NextInt16 ( ) : Int16
NextInt32 ( ) : Int32
NextInt64 ( ) : Int64
NextUInt16 ( ) : UInt16
NextUInt32 ( ) : UInt32
NextUInt64 ( ) : UInt64
NextUtf8String ( int length ) : string
Peek ( int index, int length ) : BufferChunk

Create a return BufferChunk containing a subset of the data from the valid data.

Reset ( ) : void

Reset the BufferChunk's Index and Length pointers to zero so it is ready for reuse as an empty BufferChunk. Note that the actual byte[] buffer is not reset, so the memory is not deallocated/reallocated, allowing for more efficient reuse of memory without abusing the GC

Reset ( int index, int length ) : void

Reset the BufferChunk's Index and Length pointers to supplied values

SetByte ( int index, byte data ) : void

Modifies 1 byte inside the BufferChunk This method is included for consistency. It simply forwards to the indexer.

SetInt16 ( int index, Int16 data ) : void

Modifies 2 bytes inside the BufferChunk

SetInt32 ( int index, Int32 data ) : void

Modifies 4 bytes inside the BufferChunk

SetInt64 ( int index, Int64 data ) : void

Modifies 8 bytes inside the BufferChunk

SetPaddedUInt16 ( int index, UInt16 data ) : void
SetPaddedUInt32 ( int index, UInt32 data ) : void
SetPaddedUInt64 ( int index, UInt64 data ) : void
SetUInt16 ( int index, UInt16 data ) : void

Modifies 2 bytes inside the BufferChunk

SetUInt32 ( int index, UInt32 data ) : void

Modifies 4 bytes inside the BufferChunk

SetUInt64 ( int index, UInt64 data ) : void

Modifies 8 bytes inside the BufferChunk

SetUTF8String ( int index, string data ) : void

Modifies UTF8.GetBytes(data) bytes inside the BufferChunk

operator ( ) : BufferChunk

Override + and += operator to allow appending of buffers, provided there is room in the left-most BufferChunk

this ( int index ) : byte

Indexer used to allow us to treat a BufferChunk like a byte[]. Useful when making in place modifications or reads from a BufferChunk.

비공개 메소드들

메소드 설명
BufferChunk ( ) : System
ValidateIntPtr ( IntPtr ptr ) : void
ValidateNonNegative ( int val ) : void
ValidateNotZeroLength ( int length ) : void
ValidateObject ( object o ) : void
ValidatePointerData ( int index, int length, int dataLength ) : void
ValidateSufficientData ( int requested, int actual ) : void
ValidateSufficientSpace ( int requested, int actual ) : void
_GetFloat ( int index ) : float
_GetInt16 ( int index ) : Int16
_GetInt32 ( int index ) : Int32
_GetUInt64 ( int index ) : UInt64
_SetFloat ( int index, float data ) : void
_SetInt16 ( int index, Int16 data ) : void
_SetInt32 ( int index, Int32 data ) : void
_SetUInt64 ( int index, UInt64 data ) : void

메소드 상세

BufferChunk() 공개 메소드

Constructor, create a BufferChunk using an existing byte[] without performing a memcopy
public BufferChunk ( byte buffer ) : System
buffer byte byte[] to be used as the data store for the BufferChunk, /// cannot be null or zero length
리턴 System

BufferChunk() 공개 메소드

Constructor, create a BufferChunk from its constituent parts
public BufferChunk ( byte buffer, int index, int length ) : System
buffer byte byte[] to be used as the data store for the BufferChunk
index int offset at which the valid data starts
length int amount of 'valid data'
리턴 System

BufferChunk() 공개 메소드

Constructor, create a new BufferChunk and allocate a new byte[] to hold the data.
public BufferChunk ( int size ) : System
size int int size of the new byte[] to create, must be >= 1
리턴 System

Clear() 공개 메소드

Used to zero out the data area of the BufferChunk.
public Clear ( ) : void
리턴 void

Clone() 공개 메소드

Creates a shallow copy (new Index and Length, duplicate reference to the same Buffer) of a BufferChunk.
public Clone ( ) : object
리턴 object

Compare() 공개 정적인 메소드

public static Compare ( byte obj1, byte obj2 ) : bool
obj1 byte
obj2 byte
리턴 bool

Copy() 공개 정적인 메소드

public static Copy ( byte source ) : byte[]
source byte
리턴 byte[]

CopyFrom() 공개 메소드

public CopyFrom ( IntPtr source, Int32 alength ) : void
source System.IntPtr
alength System.Int32
리턴 void

CopyTo() 공개 메소드

Copy the valid data section of 'this' to the destination BufferChunk overwriting dest's previous contents This method does not allow dest's valid data section to grow or shrink (i.e. treat valid data as a fixed buffer)
public CopyTo ( BufferChunk destination, int index ) : void
destination BufferChunk BufferChunk
index int offset in the destination BufferChunk's valid data
리턴 void

CopyTo() 공개 메소드

public CopyTo ( IntPtr destination, Int32 length ) : void
destination IntPtr
length Int32
리턴 void

Dispose() 공개 메소드

Disposes the internal state of the object
public Dispose ( ) : void
리턴 void

GetByte() 공개 메소드

Retrieves 1 byte from inside the BufferChunk This method is included for consistency. It simply forwards to the indexer.
public GetByte ( int index ) : byte
index int Offset into the valid data
리턴 byte

GetDouble() 공개 메소드

public GetDouble ( int index ) : double
index int
리턴 double

GetFloat() 공개 메소드

public GetFloat ( int index ) : float
index int
리턴 float

GetInt16() 공개 메소드

Retrieves 2 bytes inside the BufferChunk
public GetInt16 ( int index ) : Int16
index int Offset into the valid data
리턴 Int16

GetInt32() 공개 메소드

Retrieves 4 bytes inside the BufferChunk
public GetInt32 ( int index ) : int
index int Offset into the valid data
리턴 int

GetInt64() 공개 메소드

Retrieves 8 bytes inside the BufferChunk
public GetInt64 ( int index ) : long
index int Offset into the valid data
리턴 long

GetPaddedUInt16() 공개 메소드

public GetPaddedUInt16 ( int index ) : UInt16
index int
리턴 UInt16

GetPaddedUInt32() 공개 메소드

public GetPaddedUInt32 ( int index ) : UInt32
index int
리턴 UInt32

GetPaddedUInt64() 공개 메소드

public GetPaddedUInt64 ( int index ) : UInt64
index int
리턴 UInt64

GetUInt16() 공개 메소드

Retrieves 2 bytes inside the BufferChunk
public GetUInt16 ( int index ) : UInt16
index int Offset into the valid data
리턴 UInt16

GetUInt32() 공개 메소드

Retrieves 4 bytes inside the BufferChunk
public GetUInt32 ( int index ) : UInt32
index int Offset into the valid data
리턴 UInt32

GetUInt64() 공개 메소드

Retrieves 8 bytes inside the BufferChunk
public GetUInt64 ( int index ) : UInt64
index int Offset into the valid data
리턴 UInt64

GetUTF8String() 공개 메소드

Retrieves length bytes from inside the BufferChunk and converts from UTF8 string
public GetUTF8String ( int index, int length ) : string
index int Offset into the valid data
length int
리턴 string

NextBufferChunk() 공개 메소드

Returns a BufferChunk consisting of the next 'length' bytes of the BufferChunk instance. Automatically increments Index and decrements Length. This function is useful for iterative functions that parse through a large BufferChunk returning smaller BufferChunks
public NextBufferChunk ( int length ) : BufferChunk
length int int
리턴 BufferChunk

NextBufferChunkMax() 공개 메소드

Returns the requested amount of data, or whatever remains if length > this.length
public NextBufferChunkMax ( int length ) : BufferChunk
length int
리턴 BufferChunk

NextByte() 공개 메소드

public NextByte ( ) : byte
리턴 byte

NextDouble() 공개 메소드

public NextDouble ( ) : double
리턴 double

NextFloat() 공개 메소드

public NextFloat ( ) : float
리턴 float

NextInt16() 공개 메소드

public NextInt16 ( ) : Int16
리턴 Int16

NextInt32() 공개 메소드

public NextInt32 ( ) : Int32
리턴 Int32

NextInt64() 공개 메소드

public NextInt64 ( ) : Int64
리턴 Int64

NextUInt16() 공개 메소드

public NextUInt16 ( ) : UInt16
리턴 UInt16

NextUInt32() 공개 메소드

public NextUInt32 ( ) : UInt32
리턴 UInt32

NextUInt64() 공개 메소드

public NextUInt64 ( ) : UInt64
리턴 UInt64

NextUtf8String() 공개 메소드

public NextUtf8String ( int length ) : string
length int
리턴 string

Peek() 공개 메소드

Create a return BufferChunk containing a subset of the data from the valid data.
public Peek ( int index, int length ) : BufferChunk
index int int index into the valid data area
length int int length of the data to copy
리턴 BufferChunk

Reset() 공개 메소드

Reset the BufferChunk's Index and Length pointers to zero so it is ready for reuse as an empty BufferChunk. Note that the actual byte[] buffer is not reset, so the memory is not deallocated/reallocated, allowing for more efficient reuse of memory without abusing the GC
public Reset ( ) : void
리턴 void

Reset() 공개 메소드

Reset the BufferChunk's Index and Length pointers to supplied values
public Reset ( int index, int length ) : void
index int
length int
리턴 void

SetByte() 공개 메소드

Modifies 1 byte inside the BufferChunk This method is included for consistency. It simply forwards to the indexer.
public SetByte ( int index, byte data ) : void
index int Offset into the valid data
data byte Value to write at index
리턴 void

SetInt16() 공개 메소드

Modifies 2 bytes inside the BufferChunk
public SetInt16 ( int index, Int16 data ) : void
index int Offset into the valid data
data Int16 Value to write at index
리턴 void

SetInt32() 공개 메소드

Modifies 4 bytes inside the BufferChunk
public SetInt32 ( int index, Int32 data ) : void
index int Offset into the valid data
data Int32 Value to write at index
리턴 void

SetInt64() 공개 메소드

Modifies 8 bytes inside the BufferChunk
public SetInt64 ( int index, Int64 data ) : void
index int Offset into the valid data
data Int64 Value to write at index
리턴 void

SetPaddedUInt16() 공개 메소드

public SetPaddedUInt16 ( int index, UInt16 data ) : void
index int
data UInt16
리턴 void

SetPaddedUInt32() 공개 메소드

public SetPaddedUInt32 ( int index, UInt32 data ) : void
index int
data UInt32
리턴 void

SetPaddedUInt64() 공개 메소드

public SetPaddedUInt64 ( int index, UInt64 data ) : void
index int
data UInt64
리턴 void

SetUInt16() 공개 메소드

Modifies 2 bytes inside the BufferChunk
public SetUInt16 ( int index, UInt16 data ) : void
index int Offset into the valid data
data UInt16 Value to write at index
리턴 void

SetUInt32() 공개 메소드

Modifies 4 bytes inside the BufferChunk
public SetUInt32 ( int index, UInt32 data ) : void
index int Offset into the valid data
data UInt32 Value to write at index
리턴 void

SetUInt64() 공개 메소드

Modifies 8 bytes inside the BufferChunk
public SetUInt64 ( int index, UInt64 data ) : void
index int Offset into the valid data
data UInt64 Value to write at index
리턴 void

SetUTF8String() 공개 메소드

Modifies UTF8.GetBytes(data) bytes inside the BufferChunk
public SetUTF8String ( int index, string data ) : void
index int Offset into the valid data
data string Value to write at index
리턴 void

operator() 공개 정적인 메소드

Override + and += operator to allow appending of buffers, provided there is room in the left-most BufferChunk
public static operator ( ) : BufferChunk
리턴 BufferChunk

this() 공개 메소드

Indexer used to allow us to treat a BufferChunk like a byte[]. Useful when making in place modifications or reads from a BufferChunk.
public this ( int index ) : byte
index int
리턴 byte