C# 클래스 GSF.IO.BinaryStreamBase

An abstract class for reading/writing to a little endian stream.
상속: IDisposable
파일 보기 프로젝트 열기: GridProtectionAlliance/openHistorian 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
Stream BinaryStreamStream
Utf8 System.Text.Encoding

공개 메소드들

메소드 설명
Copy ( long source, long destination, int length ) : void

Copies a specified number of bytes to a new location

Dispose ( ) : void

Releases all the resources used by the BinaryStreamBase object.

Flush ( ) : void

When overridden in a derived class, clears all buffers for this stream and causes any buffered data to be written to the underlying device.

InsertBytes ( int numberOfBytes, int lengthOfValidDataToShift ) : void

Inserts a certain number of bytes into the stream, shifting valid data to the right. The stream's position remains unchanged. (ie. pointing to the beginning of the newly inserted bytes).

Internally this fuction merely acomplishes an Array.Copy(stream,position,stream,position+numberOfBytes,lengthOfValidDataToShift) However, it's much more complicated than this. So this is a pretty useful function. The newly created space is uninitialized.

Read ( byte buffer, int offset, int count ) : int

When overridden in a derived class, reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.

Read7BitUInt32 ( ) : uint

Reads from the underlying stream in little endian format. Advancing the position.

Read7BitUInt64 ( ) : ulong

Reads from the underlying stream in little endian format. Advancing the position.

ReadAll ( byte buffer, int length ) : void

Reads from the underlying stream in little endian format. Advancing the position.

ReadAll ( byte buffer, int position, int length ) : void

Reads all of the provided bytes. Will not return prematurely, but continue to execute a Read command until the entire length has been read.

ReadBoolean ( ) : bool

Reads from the underlying stream in little endian format. Advancing the position.

ReadBytes ( ) : byte[]

Reads from the underlying stream in little endian format. Advancing the position.

ReadBytes ( int count ) : byte[]

Reads from the underlying stream in little endian format. Advancing the position.

ReadDateTime ( ) : System.DateTime

Reads from the underlying stream in little endian format. Advancing the position.

ReadDecimal ( ) : decimal

Reads from the underlying stream in little endian format. Advancing the position.

ReadDouble ( ) : double

Reads from the underlying stream in little endian format. Advancing the position.

ReadGuid ( ) : System.Guid

Reads from the underlying stream in little endian format. Advancing the position.

ReadInt16 ( ) : short

Reads from the underlying stream in little endian format. Advancing the position.

ReadInt32 ( ) : int

Reads from the underlying stream in little endian format. Advancing the position.

ReadInt64 ( ) : long

Reads from the underlying stream in little endian format. Advancing the position.

ReadInt8 ( ) : sbyte

Reads from the underlying stream in little endian format. Advancing the position.

ReadSingle ( ) : float

Reads from the underlying stream in little endian format. Advancing the position.

ReadString ( ) : string

Reads from the underlying stream in little endian format. Advancing the position.

ReadUInt ( int bytes ) : ulong

Reads from the underlying stream in little endian format. Advancing the position.

ReadUInt16 ( ) : ushort

Reads from the underlying stream in little endian format. Advancing the position.

ReadUInt24 ( ) : uint

Reads from the underlying stream in little endian format. Advancing the position.

ReadUInt32 ( ) : uint

Reads from the underlying stream in little endian format. Advancing the position.

ReadUInt40 ( ) : ulong

Reads from the underlying stream in little endian format. Advancing the position.

ReadUInt48 ( ) : ulong

Reads from the underlying stream in little endian format. Advancing the position.

ReadUInt56 ( ) : ulong

Reads from the underlying stream in little endian format. Advancing the position.

ReadUInt64 ( ) : ulong

Reads from the underlying stream in little endian format. Advancing the position.

ReadUInt8 ( ) : byte

Reads from the underlying stream in little endian format. Advancing the position.

RemoveBytes ( int numberOfBytes, int lengthOfValidDataToShift ) : void

Removes a certain number of bytes from the stream, shifting valid data after this location to the left. The stream's position remains unchanged. (ie. pointing to where the data used to exist).

Internally this fuction merely acomplishes an Array.Copy(stream,position+numberOfBytes,stream,position,lengthOfValidDataToShift) However, it's much more complicated than this. So this is a pretty useful function. The space at the end of the copy is uninitialized.

Seek ( long offset, SeekOrigin origin ) : long

When overridden in a derived class, sets the position within the current stream.

SetLength ( long value ) : void

When overridden in a derived class, sets the length of the current stream.

TryReadBytes ( int maxLength, byte &value ) : bool

Reads a byte array from the provided stream. If the size of the stream exceedes maxLength value is set to null and this function returns false.

This method can be used to limit the byte size returned. Since an untrusted source could claim that the length is int.MaxValue, this prevents allocating 2GB of RAM to store the result.

TryReadString ( int maxLength, string &value ) : bool

Reads a string from the provided stream. If the size of the string exceedes maxLength value is set to null and this function returns false.

This method can be used to limit the byte size returned. Since an untrusted source could claim that the length is int.MaxValue, this prevents allocating 2GB of RAM to store the result.

UpdateLocalBuffer ( bool isWriting ) : void

Updates the local buffer data.

Write ( System.DateTime value ) : void

Writes the specifed value to the underlying stream in little-endian format.

Write ( System.Guid value ) : void

Writes the specifed value to the underlying stream in little-endian format.

Write ( bool value ) : void

Writes the specifed value to the underlying stream in little-endian format.

Write ( byte value ) : void

Writes the specifed value to the underlying stream in little-endian format.

Write ( byte buffer, int length ) : void

Writes the specifed buffer to the underlying stream in little-endian format.

Write ( byte buffer, int offset, int count ) : void

When overridden in a derived class, writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.

Write ( decimal value ) : void

Writes the specifed value to the underlying stream in little-endian format.

Write ( double value ) : void

Writes the specifed value to the underlying stream in little-endian format.

Write ( float value ) : void

Writes the specifed value to the underlying stream in little-endian format.

Write ( int value ) : void

Writes the specifed value to the underlying stream in little-endian format.

Write ( long value ) : void

Writes the specifed value to the underlying stream in little-endian format.

Write ( sbyte value ) : void

Writes the specifed value to the underlying stream in little-endian format.

Write ( short value ) : void

Writes the specifed value to the underlying stream in little-endian format.

Write ( string value ) : void

Writes the specifed value to the underlying stream in little-endian format.

Write ( uint value ) : void

Writes the specifed value to the underlying stream in little-endian format.

Write ( ulong value ) : void

Writes the specifed value to the underlying stream in little-endian format.

Write ( ushort value ) : void

Writes the specifed value to the underlying stream in little-endian format.

Write7Bit ( uint value ) : void

Writes the specifed value to the underlying stream in little-endian format.

Write7Bit ( ulong value ) : void

Writes the specifed value to the underlying stream in little-endian format.

WriteUInt ( ulong value, int bytes ) : void

Writes the specifed value to the underlying stream in little-endian format.

WriteUInt24 ( uint value ) : void

Writes the specifed value to the underlying stream in little-endian format.

WriteUInt40 ( ulong value ) : void

Writes the specifed value to the underlying stream in little-endian format.

WriteUInt48 ( ulong value ) : void

Writes the specifed value to the underlying stream in little-endian format.

WriteUInt56 ( ulong value ) : void

Writes the specifed value to the underlying stream in little-endian format.

WriteWithLength ( byte value ) : void

Writes the specifed value to the underlying stream in little-endian format.

보호된 메소드들

메소드 설명
BinaryStreamBase ( ) : System

Creates a BinaryStreamBase

Dispose ( bool disposing ) : void

Releases the unmanaged resources used by the BinaryStreamBase object and optionally releases the managed resources.

메소드 상세

BinaryStreamBase() 보호된 메소드

Creates a BinaryStreamBase
protected BinaryStreamBase ( ) : System
리턴 System

Copy() 공개 메소드

Copies a specified number of bytes to a new location
public Copy ( long source, long destination, int length ) : void
source long
destination long
length int
리턴 void

Dispose() 공개 메소드

Releases all the resources used by the BinaryStreamBase object.
public Dispose ( ) : void
리턴 void

Dispose() 보호된 메소드

Releases the unmanaged resources used by the BinaryStreamBase object and optionally releases the managed resources.
protected Dispose ( bool disposing ) : void
disposing bool true to release both managed and unmanaged resources; false to release only unmanaged resources.
리턴 void

Flush() 공개 추상적인 메소드

When overridden in a derived class, clears all buffers for this stream and causes any buffered data to be written to the underlying device.
An I/O error occurs.
public abstract Flush ( ) : void
리턴 void

InsertBytes() 공개 메소드

Inserts a certain number of bytes into the stream, shifting valid data to the right. The stream's position remains unchanged. (ie. pointing to the beginning of the newly inserted bytes).
Internally this fuction merely acomplishes an Array.Copy(stream,position,stream,position+numberOfBytes,lengthOfValidDataToShift) However, it's much more complicated than this. So this is a pretty useful function. The newly created space is uninitialized.
public InsertBytes ( int numberOfBytes, int lengthOfValidDataToShift ) : void
numberOfBytes int The number of bytes to insert
lengthOfValidDataToShift int The number of bytes that will need to be shifted to perform this insert
리턴 void

Read() 공개 추상적인 메소드

When overridden in a derived class, reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.
The sum of and is larger than the buffer length. is null. or is negative. An I/O error occurs. The stream does not support reading. Methods were called after the stream was closed.
public abstract Read ( byte buffer, int offset, int count ) : int
buffer byte An array of bytes. When this method returns, the buffer contains the specified byte array with the values between and ( + - 1) replaced by the bytes read from the current source.
offset int The zero-based byte offset in at which to begin storing the data read from the current stream.
count int The maximum number of bytes to be read from the current stream.
리턴 int

Read7BitUInt32() 공개 메소드

Reads from the underlying stream in little endian format. Advancing the position.
public Read7BitUInt32 ( ) : uint
리턴 uint

Read7BitUInt64() 공개 메소드

Reads from the underlying stream in little endian format. Advancing the position.
public Read7BitUInt64 ( ) : ulong
리턴 ulong

ReadAll() 공개 메소드

Reads from the underlying stream in little endian format. Advancing the position.
public ReadAll ( byte buffer, int length ) : void
buffer byte the pointer to write the data to
length int the number of bytes to read
리턴 void

ReadAll() 공개 메소드

Reads all of the provided bytes. Will not return prematurely, but continue to execute a Read command until the entire length has been read.
occurs if the end of the stream has been reached.
public ReadAll ( byte buffer, int position, int length ) : void
buffer byte
position int
length int
리턴 void

ReadBoolean() 공개 메소드

Reads from the underlying stream in little endian format. Advancing the position.
public ReadBoolean ( ) : bool
리턴 bool

ReadBytes() 공개 메소드

Reads from the underlying stream in little endian format. Advancing the position.
public ReadBytes ( ) : byte[]
리턴 byte[]

ReadBytes() 공개 메소드

Reads from the underlying stream in little endian format. Advancing the position.
public ReadBytes ( int count ) : byte[]
count int the number of bytes to read
리턴 byte[]

ReadDateTime() 공개 메소드

Reads from the underlying stream in little endian format. Advancing the position.
public ReadDateTime ( ) : System.DateTime
리턴 System.DateTime

ReadDecimal() 공개 메소드

Reads from the underlying stream in little endian format. Advancing the position.
public ReadDecimal ( ) : decimal
리턴 decimal

ReadDouble() 공개 메소드

Reads from the underlying stream in little endian format. Advancing the position.
public ReadDouble ( ) : double
리턴 double

ReadGuid() 공개 메소드

Reads from the underlying stream in little endian format. Advancing the position.
public ReadGuid ( ) : System.Guid
리턴 System.Guid

ReadInt16() 공개 메소드

Reads from the underlying stream in little endian format. Advancing the position.
public ReadInt16 ( ) : short
리턴 short

ReadInt32() 공개 메소드

Reads from the underlying stream in little endian format. Advancing the position.
public ReadInt32 ( ) : int
리턴 int

ReadInt64() 공개 메소드

Reads from the underlying stream in little endian format. Advancing the position.
public ReadInt64 ( ) : long
리턴 long

ReadInt8() 공개 메소드

Reads from the underlying stream in little endian format. Advancing the position.
public ReadInt8 ( ) : sbyte
리턴 sbyte

ReadSingle() 공개 메소드

Reads from the underlying stream in little endian format. Advancing the position.
public ReadSingle ( ) : float
리턴 float

ReadString() 공개 메소드

Reads from the underlying stream in little endian format. Advancing the position.
public ReadString ( ) : string
리턴 string

ReadUInt() 공개 메소드

Reads from the underlying stream in little endian format. Advancing the position.
public ReadUInt ( int bytes ) : ulong
bytes int the number of bytes in the value
리턴 ulong

ReadUInt16() 공개 메소드

Reads from the underlying stream in little endian format. Advancing the position.
public ReadUInt16 ( ) : ushort
리턴 ushort

ReadUInt24() 공개 메소드

Reads from the underlying stream in little endian format. Advancing the position.
public ReadUInt24 ( ) : uint
리턴 uint

ReadUInt32() 공개 메소드

Reads from the underlying stream in little endian format. Advancing the position.
public ReadUInt32 ( ) : uint
리턴 uint

ReadUInt40() 공개 메소드

Reads from the underlying stream in little endian format. Advancing the position.
public ReadUInt40 ( ) : ulong
리턴 ulong

ReadUInt48() 공개 메소드

Reads from the underlying stream in little endian format. Advancing the position.
public ReadUInt48 ( ) : ulong
리턴 ulong

ReadUInt56() 공개 메소드

Reads from the underlying stream in little endian format. Advancing the position.
public ReadUInt56 ( ) : ulong
리턴 ulong

ReadUInt64() 공개 메소드

Reads from the underlying stream in little endian format. Advancing the position.
public ReadUInt64 ( ) : ulong
리턴 ulong

ReadUInt8() 공개 메소드

Reads from the underlying stream in little endian format. Advancing the position.
public ReadUInt8 ( ) : byte
리턴 byte

RemoveBytes() 공개 메소드

Removes a certain number of bytes from the stream, shifting valid data after this location to the left. The stream's position remains unchanged. (ie. pointing to where the data used to exist).
Internally this fuction merely acomplishes an Array.Copy(stream,position+numberOfBytes,stream,position,lengthOfValidDataToShift) However, it's much more complicated than this. So this is a pretty useful function. The space at the end of the copy is uninitialized.
public RemoveBytes ( int numberOfBytes, int lengthOfValidDataToShift ) : void
numberOfBytes int The distance to shift. Positive means shifting to the right (ie. inserting data) /// Negative means shift to the left (ie. deleteing data)
lengthOfValidDataToShift int The number of bytes that will need to be shifted to perform the remove. /// This only includes the data that is valid after the shift is complete, and not the data that will be removed.
리턴 void

Seek() 공개 메소드

When overridden in a derived class, sets the position within the current stream.
An I/O error occurs. The stream does not support seeking, such as if the stream is constructed from a pipe or console output. Methods were called after the stream was closed.
public Seek ( long offset, SeekOrigin origin ) : long
offset long A byte offset relative to the parameter.
origin SeekOrigin A value of type indicating the reference point used to obtain the new position.
리턴 long

SetLength() 공개 추상적인 메소드

When overridden in a derived class, sets the length of the current stream.
An I/O error occurs. The stream does not support both writing and seeking, such as if the stream is constructed from a pipe or console output. Methods were called after the stream was closed.
public abstract SetLength ( long value ) : void
value long The desired length of the current stream in bytes.
리턴 void

TryReadBytes() 공개 메소드

Reads a byte array from the provided stream. If the size of the stream exceedes maxLength value is set to null and this function returns false.
This method can be used to limit the byte size returned. Since an untrusted source could claim that the length is int.MaxValue, this prevents allocating 2GB of RAM to store the result.
public TryReadBytes ( int maxLength, byte &value ) : bool
maxLength int
value byte
리턴 bool

TryReadString() 공개 메소드

Reads a string from the provided stream. If the size of the string exceedes maxLength value is set to null and this function returns false.
This method can be used to limit the byte size returned. Since an untrusted source could claim that the length is int.MaxValue, this prevents allocating 2GB of RAM to store the result.
public TryReadString ( int maxLength, string &value ) : bool
maxLength int The maximum number of characters in the string.
value string an output
리턴 bool

UpdateLocalBuffer() 공개 메소드

Updates the local buffer data.
public UpdateLocalBuffer ( bool isWriting ) : void
isWriting bool hints to the stream if write access is desired.
리턴 void

Write() 공개 메소드

Writes the specifed value to the underlying stream in little-endian format.
public Write ( System.DateTime value ) : void
value System.DateTime the value to write
리턴 void

Write() 공개 메소드

Writes the specifed value to the underlying stream in little-endian format.
public Write ( System.Guid value ) : void
value System.Guid the value to write
리턴 void

Write() 공개 메소드

Writes the specifed value to the underlying stream in little-endian format.
public Write ( bool value ) : void
value bool the value to write
리턴 void

Write() 공개 메소드

Writes the specifed value to the underlying stream in little-endian format.
public Write ( byte value ) : void
value byte the value to write
리턴 void

Write() 공개 메소드

Writes the specifed buffer to the underlying stream in little-endian format.
public Write ( byte buffer, int length ) : void
buffer byte the pointer to the first byte
length int the number of bytes to write
리턴 void

Write() 공개 추상적인 메소드

When overridden in a derived class, writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.
public abstract Write ( byte buffer, int offset, int count ) : void
buffer byte An array of bytes. This method copies bytes from to the current stream.
offset int The zero-based byte offset in at which to begin copying bytes to the current stream.
count int The number of bytes to be written to the current stream.
리턴 void

Write() 공개 메소드

Writes the specifed value to the underlying stream in little-endian format.
public Write ( decimal value ) : void
value decimal the value to write
리턴 void

Write() 공개 메소드

Writes the specifed value to the underlying stream in little-endian format.
public Write ( double value ) : void
value double the value to write
리턴 void

Write() 공개 메소드

Writes the specifed value to the underlying stream in little-endian format.
public Write ( float value ) : void
value float the value to write
리턴 void

Write() 공개 메소드

Writes the specifed value to the underlying stream in little-endian format.
public Write ( int value ) : void
value int the value to write
리턴 void

Write() 공개 메소드

Writes the specifed value to the underlying stream in little-endian format.
public Write ( long value ) : void
value long the value to write
리턴 void

Write() 공개 메소드

Writes the specifed value to the underlying stream in little-endian format.
public Write ( sbyte value ) : void
value sbyte the value to write
리턴 void

Write() 공개 메소드

Writes the specifed value to the underlying stream in little-endian format.
public Write ( short value ) : void
value short the value to write
리턴 void

Write() 공개 메소드

Writes the specifed value to the underlying stream in little-endian format.
public Write ( string value ) : void
value string the value to write
리턴 void

Write() 공개 메소드

Writes the specifed value to the underlying stream in little-endian format.
public Write ( uint value ) : void
value uint the value to write
리턴 void

Write() 공개 메소드

Writes the specifed value to the underlying stream in little-endian format.
public Write ( ulong value ) : void
value ulong the value to write
리턴 void

Write() 공개 메소드

Writes the specifed value to the underlying stream in little-endian format.
public Write ( ushort value ) : void
value ushort the value to write
리턴 void

Write7Bit() 공개 메소드

Writes the specifed value to the underlying stream in little-endian format.
public Write7Bit ( uint value ) : void
value uint the value to write
리턴 void

Write7Bit() 공개 메소드

Writes the specifed value to the underlying stream in little-endian format.
public Write7Bit ( ulong value ) : void
value ulong the value to write
리턴 void

WriteUInt() 공개 메소드

Writes the specifed value to the underlying stream in little-endian format.
public WriteUInt ( ulong value, int bytes ) : void
value ulong the value to write
bytes int the number of bytes to write.
리턴 void

WriteUInt24() 공개 메소드

Writes the specifed value to the underlying stream in little-endian format.
public WriteUInt24 ( uint value ) : void
value uint the value to write
리턴 void

WriteUInt40() 공개 메소드

Writes the specifed value to the underlying stream in little-endian format.
public WriteUInt40 ( ulong value ) : void
value ulong the value to write
리턴 void

WriteUInt48() 공개 메소드

Writes the specifed value to the underlying stream in little-endian format.
public WriteUInt48 ( ulong value ) : void
value ulong the value to write
리턴 void

WriteUInt56() 공개 메소드

Writes the specifed value to the underlying stream in little-endian format.
public WriteUInt56 ( ulong value ) : void
value ulong the value to write
리턴 void

WriteWithLength() 공개 메소드

Writes the specifed value to the underlying stream in little-endian format.
public WriteWithLength ( byte value ) : void
value byte the value to write
리턴 void

프로퍼티 상세

Stream 공개적으로 프로퍼티

A Stream implementation of this BinaryStreamBase
public BinaryStreamStream,GSF.IO Stream
리턴 BinaryStreamStream

Utf8 공개적으로 정적으로 프로퍼티

A shared instance of UTF8 encoding.
public static Encoding,System.Text Utf8
리턴 System.Text.Encoding