TriLib
Search Results for

    Show / Hide Table of Contents

    Class StreamExtensions

    Represents a series of Stream extension methods.

    Inheritance
    object
    StreamExtensions
    Inherited Members
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: TriLibCore.Extensions
    Assembly: TriLibCore.dll
    Syntax
    public static class StreamExtensions

    Methods

    MatchRegex(Stream, params string[])

    Tries to match the given RegEx patterns on the Stream contents.

    Declaration
    public static bool MatchRegex(this Stream stream, params string[] patterns)
    Parameters
    Type Name Description
    Stream stream

    The Stream to perform the search.

    string[] patterns

    The list of RegEx patterns to search for.

    Returns
    Type Description
    bool

    true, if all patterns match. Otherwise, false.

    ReadBytes(Stream)

    Reads all Stream Bytes into a Byte Array.

    Declaration
    public static byte[] ReadBytes(this Stream input)
    Parameters
    Type Name Description
    Stream input

    The input Stream.

    Returns
    Type Description
    byte[]

    The Stream Data Bytes.

    ReadBytes(Stream, Func<int, object, byte[]>, object)

    Reads all Stream Bytes into a Byte Array.

    Declaration
    public static byte[] ReadBytes(this Stream input, Func<int, object, byte[]> bufferCallback, object customData = null)
    Parameters
    Type Name Description
    Stream input

    The input Stream.

    Func<int, object, byte[]> bufferCallback

    The callback used to retrieve the byte buffer where the Stream data will be write to.

    object customData

    A custom parameter to be sent to the buffer callback.

    Returns
    Type Description
    byte[]

    The Stream Data Bytes.

    ReadBytesUnknownLength(Stream)

    Reads all Stream Bytes into a Byte Array when the Stream has unknown length.

    Declaration
    public static byte[] ReadBytesUnknownLength(this Stream input)
    Parameters
    Type Name Description
    Stream input

    The input Stream.

    Returns
    Type Description
    byte[]

    The Stream Data Bytes.

    TryToDispose(Stream)

    Tries to dispose the given Stream.

    Declaration
    public static void TryToDispose(this Stream stream)
    Parameters
    Type Name Description
    Stream stream

    The Stream to dispose.

    In this article
    Back to top Generated by DocFX