C# Class CoreTechs.Common.StreamExtensions

Datei anzeigen Open project: Core-Techs/Common

Public Methods

Method Description
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

Method Details

Bookmark() public static method

Creates a StreamBookmark.
public static Bookmark ( this stream ) : StreamBookmark
stream this
return StreamBookmark

CountBytesUntil() public static method

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
return long

CountBytesUntil() public static method

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
return long

CountBytesUntilAny() public static method

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
return long

CountBytesUntilAny() public static method

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
return long

EnumerateBytes() public static method

public static EnumerateBytes ( this stream ) : IEnumerable
stream this
return IEnumerable

EnumerateBytesUntil() public static method

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.
return IEnumerable

EnumerateBytesUntil() public static method

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.
return IEnumerable

EnumerateBytesUntilAny() public static method

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.
return IEnumerable

EnumerateBytesUntilAny() public static method

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.
return IEnumerable

SeekEndOf() public static method

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
return bool

SeekEndOf() public static method

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
return bool

SeekEndOfAny() public static method

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
return byte[]

SeekEndOfAny() public static method

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
return string

SeekEndOfAny() public static method

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
return string

SeekStartOf() public static method

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
return bool

SeekStartOf() public static method

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
return bool

SeekStartOfAny() public static method

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
return byte[]

SeekStartOfAny() public static method

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
return string

SeekStartOfAny() public static method

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
return string

ToMemoryStream() public static method

public static ToMemoryStream ( this bytes ) : MemoryStream
bytes this
return System.IO.MemoryStream