C# Класс GSF.IO.StreamExtensions

Defines extension functions related to Stream manipulation.
Показать файл Открыть проект

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

Метод Описание
CopyTo ( this source, Stream destination, long length, byte buffer ) : void

Writes the contents of a stream to the provided stream.

Read7BitUInt32 ( this stream ) : uint

Reads the 7-bit encoded value from the stream.

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

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

ReadBoolean ( this stream ) : bool

Reads the value from the stream in little endian format.

ReadBytes ( this stream ) : byte[]

Reads a byte array from a Stream. The number of bytes should be prefixed in the stream.

ReadBytes ( this stream, int length ) : byte[]

Reads a byte array from a Stream. The number of bytes should be prefixed in the stream.

ReadChar ( this stream ) : char

Reads the value from the stream in little endian format.

ReadDateTime ( this stream ) : System.DateTime

Reads the value from the stream in little endian format.

ReadDecimal ( this stream ) : decimal

Reads a decimal from the stream in Little Endian bytes.

ReadDouble ( this stream ) : double

Reads the value from the stream in little endian format.

ReadGuid ( this stream ) : System.Guid

Reads a Guid from the stream in Little Endian bytes.

ReadInt16 ( this stream ) : short

Reads the value from the stream in little endian format.

ReadInt32 ( this stream ) : int

Reads the value from the stream in little endian format.

ReadInt32Collection ( this stream ) : int[]

Writes the supplied string to a Stream in UTF8 encoding.

ReadInt64 ( this stream ) : long

Reads the value from the stream in little endian format.

ReadNullableString ( this stream ) : string

Reads a string from a Stream that was encoded in UTF8. Value can be null and is prefixed with a boolean.

ReadObject ( this stream ) : object

Reads an object from a stream.

ReadSByte ( this stream ) : sbyte

Reads the value from the stream in little endian format.

ReadSingle ( this stream ) : float

Reads the value from the stream in little endian format.

ReadStream ( this source ) : byte[]

Reads entire Stream contents, and returns byte array of data.

ReadString ( this stream ) : string

Reads a string from a Stream that was encoded in UTF8.

ReadStringCollection ( this stream ) : string[]

Writes the supplied string to a Stream in UTF8 encoding.

ReadUInt16 ( this stream ) : ushort

Reads the value from the stream in little endian format.

ReadUInt32 ( this stream ) : uint

Reads the value from the stream in little endian format.

ReadUInt64 ( this stream ) : ulong

Reads the value from the stream in little endian format.

Write ( this stream, System.DateTime value ) : void

Writes the supplied value to stream in little endian format.

Write ( this stream, System.Guid value ) : void

Writes a guid in little endian bytes to the stream

Write ( this stream, bool value ) : void

Writes the supplied value to stream in little endian format.

Write ( this stream, byte value ) : void

Writes the supplied value to in little endian format.

Write ( this stream, char value ) : void

Writes the supplied value to stream in little endian format.

Write ( this stream, decimal value ) : void

Writes the supplied string to a Stream in UTF8 encoding.

Write ( this stream, double value ) : void

Writes the supplied value to stream in little endian format.

Write ( this stream, float value ) : void

Writes the supplied value to stream in little endian format.

Write ( this stream, int value ) : void

Writes the supplied value to stream in little endian format.

Write ( this stream, long value ) : void

Writes the supplied value to stream in little endian format.

Write ( this stream, sbyte value ) : void

Writes the supplied value to stream in little endian format.

Write ( this stream, short value ) : void

Writes the supplied value to stream in little endian format.

Write ( this stream, string value ) : void

Writes the supplied string to a Stream in UTF8 encoding.

Write ( this stream, uint value ) : void

Writes the supplied value to stream in little endian format.

Write ( this stream, ulong value ) : void

Writes the supplied value to stream in little endian format.

Write ( this stream, ushort value ) : void

Writes the supplied value to stream in little endian format.

WriteCollection ( this stream, ICollection collection ) : void

Writes the supplied Collection to a Stream.

WriteCollection ( this stream, ICollection collection ) : void

Writes the supplied Collection to a Stream.

WriteNullable ( this stream, string value ) : void

Writes the supplied string to a Stream in UTF8 encoding with a prefix if the value is null

WriteWithLength ( this stream, byte value ) : void

Writes the supplied value to stream along with prefixing the length so it can be properly read as a unit.

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

Метод Описание
CopyStream ( this source, Stream destination ) : void
ReadNextByte ( this stream ) : byte
ThrowEOS ( ) : void
WriteObject ( this stream, object value ) : void

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

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

Writes the contents of a stream to the provided stream.
public static CopyTo ( this source, Stream destination, long length, byte buffer ) : void
source this the source stream
destination Stream the destination stream.
length long the number of bytes to copy. If the source is not long enough, /// and end of stream exception will be thrown.
buffer byte A buffer to use to copy the data from one stream to another. /// This keeps the function from always allocating a new buffer for the copy
Результат void

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

Reads the 7-bit encoded value from the stream.
public static Read7BitUInt32 ( this stream ) : uint
stream this
Результат uint

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

Reads all of the provided bytes. Will not return prematurely, but continue to execute a Stream.Read command until the entire length has been read.
occurs if the end of the stream has been reached.
public static ReadAll ( this stream, byte buffer, int position, int length ) : void
stream this The stream to read from
buffer byte The buffer to write to
position int the start position in the
length int the number of bytes to read
Результат void

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

Reads the value from the stream in little endian format.
public static ReadBoolean ( this stream ) : bool
stream this the stream to read from.
Результат bool

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

Reads a byte array from a Stream. The number of bytes should be prefixed in the stream.
public static ReadBytes ( this stream ) : byte[]
stream this the stream to read from
Результат byte[]

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

Reads a byte array from a Stream. The number of bytes should be prefixed in the stream.
public static ReadBytes ( this stream, int length ) : byte[]
stream this the stream to read from
length int gets the number of bytes to read.
Результат byte[]

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

Reads the value from the stream in little endian format.
public static ReadChar ( this stream ) : char
stream this the stream to read from.
Результат char

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

Reads the value from the stream in little endian format.
public static ReadDateTime ( this stream ) : System.DateTime
stream this the stream to read from.
Результат System.DateTime

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

Reads a decimal from the stream in Little Endian bytes.
public static ReadDecimal ( this stream ) : decimal
stream this the stream to read the decimal from.
Результат decimal

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

Reads the value from the stream in little endian format.
public static ReadDouble ( this stream ) : double
stream this the stream to read from.
Результат double

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

Reads a Guid from the stream in Little Endian bytes.
public static ReadGuid ( this stream ) : System.Guid
stream this the stream to read the guid from.
Результат System.Guid

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

Reads the value from the stream in little endian format.
public static ReadInt16 ( this stream ) : short
stream this the stream to read from.
Результат short

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

Reads the value from the stream in little endian format.
public static ReadInt32 ( this stream ) : int
stream this the stream to read from.
Результат int

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

Writes the supplied string to a Stream in UTF8 encoding.
public static ReadInt32Collection ( this stream ) : int[]
stream this
Результат int[]

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

Reads the value from the stream in little endian format.
public static ReadInt64 ( this stream ) : long
stream this the stream to read from.
Результат long

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

Reads a string from a Stream that was encoded in UTF8. Value can be null and is prefixed with a boolean.
public static ReadNullableString ( this stream ) : string
stream this
Результат string

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

Reads an object from a stream.
public static ReadObject ( this stream ) : object
stream this Source stream.
Результат object

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

Reads the value from the stream in little endian format.
public static ReadSByte ( this stream ) : sbyte
stream this the stream to read from.
Результат sbyte

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

Reads the value from the stream in little endian format.
public static ReadSingle ( this stream ) : float
stream this the stream to read from.
Результат float

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

Reads entire Stream contents, and returns byte array of data.
public static ReadStream ( this source ) : byte[]
source this The to be converted to array.
Результат byte[]

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

Reads a string from a Stream that was encoded in UTF8.
public static ReadString ( this stream ) : string
stream this
Результат string

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

Writes the supplied string to a Stream in UTF8 encoding.
public static ReadStringCollection ( this stream ) : string[]
stream this
Результат string[]

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

Reads the value from the stream in little endian format.
public static ReadUInt16 ( this stream ) : ushort
stream this the stream to read from.
Результат ushort

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

Reads the value from the stream in little endian format.
public static ReadUInt32 ( this stream ) : uint
stream this the stream to read from.
Результат uint

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

Reads the value from the stream in little endian format.
public static ReadUInt64 ( this stream ) : ulong
stream this the stream to read from.
Результат ulong

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

Writes the supplied value to stream in little endian format.
public static Write ( this stream, System.DateTime value ) : void
stream this the stream to write to
value System.DateTime the value to write
Результат void

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

Writes a guid in little endian bytes to the stream
public static Write ( this stream, System.Guid value ) : void
stream this
value System.Guid
Результат void

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

Writes the supplied value to stream in little endian format.
public static Write ( this stream, bool value ) : void
stream this the stream to write to
value bool the value to write
Результат void

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

Writes the supplied value to in little endian format.
public static Write ( this stream, byte value ) : void
stream this the stream to write to
value byte the value to write
Результат void

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

Writes the supplied value to stream in little endian format.
public static Write ( this stream, char value ) : void
stream this the stream to write to
value char the value to write
Результат void

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

Writes the supplied string to a Stream in UTF8 encoding.
public static Write ( this stream, decimal value ) : void
stream this
value decimal
Результат void

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

Writes the supplied value to stream in little endian format.
public static Write ( this stream, double value ) : void
stream this the stream to write to
value double the value to write
Результат void

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

Writes the supplied value to stream in little endian format.
public static Write ( this stream, float value ) : void
stream this the stream to write to
value float the value to write
Результат void

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

Writes the supplied value to stream in little endian format.
public static Write ( this stream, int value ) : void
stream this the stream to write to
value int the value to write
Результат void

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

Writes the supplied value to stream in little endian format.
public static Write ( this stream, long value ) : void
stream this the stream to write to
value long the value to write
Результат void

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

Writes the supplied value to stream in little endian format.
public static Write ( this stream, sbyte value ) : void
stream this the stream to write to
value sbyte the value to write
Результат void

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

Writes the supplied value to stream in little endian format.
public static Write ( this stream, short value ) : void
stream this the stream to write to
value short the value to write
Результат void

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

Writes the supplied string to a Stream in UTF8 encoding.
public static Write ( this stream, string value ) : void
stream this
value string
Результат void

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

Writes the supplied value to stream in little endian format.
public static Write ( this stream, uint value ) : void
stream this the stream to write to
value uint the value to write
Результат void

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

Writes the supplied value to stream in little endian format.
public static Write ( this stream, ulong value ) : void
stream this the stream to write to
value ulong the value to write
Результат void

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

Writes the supplied value to stream in little endian format.
public static Write ( this stream, ushort value ) : void
stream this the stream to write to
value ushort the value to write
Результат void

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

Writes the supplied Collection to a Stream.
public static WriteCollection ( this stream, ICollection collection ) : void
stream this
collection ICollection
Результат void

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

Writes the supplied Collection to a Stream.
public static WriteCollection ( this stream, ICollection collection ) : void
stream this
collection ICollection
Результат void

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

Writes the supplied string to a Stream in UTF8 encoding with a prefix if the value is null
public static WriteNullable ( this stream, string value ) : void
stream this
value string
Результат void

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

Writes the supplied value to stream along with prefixing the length so it can be properly read as a unit.
public static WriteWithLength ( this stream, byte value ) : void
stream this the stream to write to
value byte the value to write
Результат void