C# Класс CoreTechs.Common.StreamExtensions

Показать файл Открыть проект

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

Метод Описание
Bookmark ( this stream ) : StreamBookmark

Creates a StreamBookmark.

CountBytesUntil ( this stream, byte target ) : long

Counts the number of bytes between the current position and the target byte sequence. The starting position is returned to once the target is found or the end of the stream is reached.

CountBytesUntil ( this stream, string target, Encoding encoding = null ) : long

Counts the number of bytes between the current position and the target string. The starting position is returned to once the target is found or the end of the stream is reached.

CountBytesUntilAny ( this stream, byte targets, byte &targetFound ) : long

Counts the number of bytes between the current position and the first occurrence of any of the target byte sequences. The starting position is returned to once a target is found or the end of the stream is reached.

CountBytesUntilAny ( this stream, string targets, string &targetFound, Encoding encoding = null ) : long

Counts the number of bytes between the current position and the first occurrence of any of the target strings. The starting position is returned to once a target is found or the end of the stream is reached.

EnumerateBytes ( this stream ) : IEnumerable
EnumerateBytesUntil ( this stream, byte target, bool positionAfterTarget = false ) : IEnumerable

Enumerates the bytes until the target begins or the end of the stream.

EnumerateBytesUntil ( this stream, string target, bool positionAfterTarget = false, Encoding encoding = null ) : IEnumerable

Enumerates the bytes until the target begins or the end of the stream.

EnumerateBytesUntilAny ( this stream, byte targets, bool positionAfterTarget = false ) : IEnumerable

Enumerates the bytes until any of the target byte sequences begin or the end of the stream.

EnumerateBytesUntilAny ( this stream, string targets, bool positionAfterTarget = false, Encoding encoding = null ) : IEnumerable

Enumerates the bytes until any of the target strings begin or the end of the stream.

SeekEndOf ( this stream, byte target ) : bool

Seeks to the position after the end of the next occurrence of the target byte sequence in the stream.

SeekEndOf ( this stream, string target, Encoding encoding = null ) : bool

Seeks to the position after the end of the next occurrence of the target string in the stream.

SeekEndOfAny ( this stream ) : byte[]

Seeks to the position after the end of the next occurrence of any of the target byte sequences found in the stream.

SeekEndOfAny ( this stream ) : string

Seeks to the position after the end of the next occurrence of any of the target strings found in the stream.

SeekEndOfAny ( this stream, Encoding encoding ) : string

Seeks to the position after the end of the next occurrence of any of the target strings found in the stream.

SeekStartOf ( this stream, byte target ) : bool

Seeks to the position of the next occurrence of the target byte sequence in the stream.

SeekStartOf ( this stream, string target, Encoding encoding = null ) : bool

Seeks to the position of the next occurrence of the target string in the stream.

SeekStartOfAny ( this stream ) : byte[]

Seeks to the position after the end of the next occurrence of any of the target byte sequences found in the stream.

SeekStartOfAny ( this stream ) : string

Seeks to the position after the end of the next occurrence of any of the target byte sequences found in the stream.

SeekStartOfAny ( this stream, Encoding encoding ) : string

Seeks to the position after the end of the next occurrence of any of the target byte sequences found in the stream.

ToMemoryStream ( this bytes ) : MemoryStream

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

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

Creates a StreamBookmark.
public static Bookmark ( this stream ) : StreamBookmark
stream this
Результат StreamBookmark

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

Counts the number of bytes between the current position and the target byte sequence. The starting position is returned to once the target is found or the end of the stream is reached.
public static CountBytesUntil ( this stream, byte target ) : long
stream this
target byte
Результат long

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

Counts the number of bytes between the current position and the target string. The starting position is returned to once the target is found or the end of the stream is reached.
public static CountBytesUntil ( this stream, string target, Encoding encoding = null ) : long
stream this
target string
encoding System.Text.Encoding
Результат long

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

Counts the number of bytes between the current position and the first occurrence of any of the target byte sequences. The starting position is returned to once a target is found or the end of the stream is reached.
public static CountBytesUntilAny ( this stream, byte targets, byte &targetFound ) : long
stream this
targets byte
targetFound byte
Результат long

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

Counts the number of bytes between the current position and the first occurrence of any of the target strings. The starting position is returned to once a target is found or the end of the stream is reached.
public static CountBytesUntilAny ( this stream, string targets, string &targetFound, Encoding encoding = null ) : long
stream this
targets string
targetFound string The string that was found first or null if no target was found.
encoding System.Text.Encoding
Результат long

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

public static EnumerateBytes ( this stream ) : IEnumerable
stream this
Результат IEnumerable

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

Enumerates the bytes until the target begins or the end of the stream.
public static EnumerateBytesUntil ( this stream, byte target, bool positionAfterTarget = false ) : IEnumerable
stream this
target byte The target to search for.
positionAfterTarget bool True to seek to the end of the target after enumeration; false to keep position at beginning of target.
Результат IEnumerable

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

Enumerates the bytes until the target begins or the end of the stream.
public static EnumerateBytesUntil ( this stream, string target, bool positionAfterTarget = false, Encoding encoding = null ) : IEnumerable
stream this
target string The target to search for.
positionAfterTarget bool True to seek to the end of the target after enumeration; false to keep position at beginning of target.
encoding System.Text.Encoding The encoding used to decode the target string.
Результат IEnumerable

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

Enumerates the bytes until any of the target byte sequences begin or the end of the stream.
public static EnumerateBytesUntilAny ( this stream, byte targets, bool positionAfterTarget = false ) : IEnumerable
stream this
targets byte The targets to search for.
positionAfterTarget bool True to seek to the end of the found target after enumeration; false to keep position at beginning of target.
Результат IEnumerable

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

Enumerates the bytes until any of the target strings begin or the end of the stream.
public static EnumerateBytesUntilAny ( this stream, string targets, bool positionAfterTarget = false, Encoding encoding = null ) : IEnumerable
stream this
targets string The targets to search for.
positionAfterTarget bool True to seek to the end of the found target after enumeration; false to keep position at beginning of target.
encoding System.Text.Encoding The encoding used to decode the target strings.
Результат IEnumerable

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

Seeks to the position after the end of the next occurrence of the target byte sequence in the stream.
public static SeekEndOf ( this stream, byte target ) : bool
stream this
target byte
Результат bool

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

Seeks to the position after the end of the next occurrence of the target string in the stream.
public static SeekEndOf ( this stream, string target, Encoding encoding = null ) : bool
stream this
target string
encoding System.Text.Encoding
Результат bool

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

Seeks to the position after the end of the next occurrence of any of the target byte sequences found in the stream.
public static SeekEndOfAny ( this stream ) : byte[]
stream this
Результат byte[]

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

Seeks to the position after the end of the next occurrence of any of the target strings found in the stream.
public static SeekEndOfAny ( this stream ) : string
stream this
Результат string

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

Seeks to the position after the end of the next occurrence of any of the target strings found in the stream.
public static SeekEndOfAny ( this stream, Encoding encoding ) : string
stream this
encoding System.Text.Encoding
Результат string

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

Seeks to the position of the next occurrence of the target byte sequence in the stream.
public static SeekStartOf ( this stream, byte target ) : bool
stream this
target byte
Результат bool

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

Seeks to the position of the next occurrence of the target string in the stream.
public static SeekStartOf ( this stream, string target, Encoding encoding = null ) : bool
stream this
target string
encoding System.Text.Encoding
Результат bool

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

Seeks to the position after the end of the next occurrence of any of the target byte sequences found in the stream.
public static SeekStartOfAny ( this stream ) : byte[]
stream this
Результат byte[]

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

Seeks to the position after the end of the next occurrence of any of the target byte sequences found in the stream.
public static SeekStartOfAny ( this stream ) : string
stream this
Результат string

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

Seeks to the position after the end of the next occurrence of any of the target byte sequences found in the stream.
public static SeekStartOfAny ( this stream, Encoding encoding ) : string
stream this
encoding System.Text.Encoding
Результат string

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

public static ToMemoryStream ( this bytes ) : MemoryStream
bytes this
Результат System.IO.MemoryStream