Search Results for

    Show / Hide Table of Contents

    Class StreamExtensions

    Extension methods for System.IO.Stream

    Inheritance
    System.Object
    StreamExtensions
    Inherited Members
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: ImageVault.Common.Lib.IO
    Assembly: ImageVault.Common.dll
    Syntax
    public static class StreamExtensions

    Methods

    ReadAll(Stream)

    Reads all data from the stream (from the current position to the end) into a buffer

    Declaration
    public static byte[] ReadAll(this Stream stream)
    Parameters
    Type Name Description
    System.IO.Stream stream
    Returns
    Type Description
    System.Byte[]

    ReadExact(Stream, Byte[], Int32, Int32)

    Reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.

    Declaration
    public static int ReadExact(this Stream stream, byte[] buffer, int offset, int count)
    Parameters
    Type Name Description
    System.IO.Stream stream
    System.Byte[] buffer

    An array of bytes. When this method returns, the buffer contains the specified byte array with the values between offset and (offset + count - 1) replaced by the bytes read from the current source.

    System.Int32 offset

    The zero-based byte offset in buffer at which to begin storing the data read from the current stream.

    System.Int32 count

    The maximum number of bytes to be read from the current stream.

    Returns
    Type Description
    System.Int32

    The total number of bytes read into the buffer. This can be less than the number of bytes requested if the end of the stream has been reached.

    Exceptions
    Type Condition
    System.ApplicationException

    If the stream returns less than 0 bytes read

    WriteIntAsHex(Stream, Int32)

    Declaration
    public static void WriteIntAsHex(this Stream stream, int val)
    Parameters
    Type Name Description
    System.IO.Stream stream
    System.Int32 val

    WriteNewLine(Stream)

    Declaration
    public static void WriteNewLine(this Stream stream)
    Parameters
    Type Name Description
    System.IO.Stream stream
    In This Article
    Back to top (c) Meriworks 2002-2022