Search Results for

    Show / Hide Table of Contents

    Class PartialStream

    Defines a System.IO.Stream that only covers parts of another stream

    Inheritance
    System.Object
    System.MarshalByRefObject
    System.IO.Stream
    PartialStream
    Implements
    System.IDisposable
    Inherited Members
    System.IO.Stream.Null
    System.IO.Stream.CopyToAsync(System.IO.Stream)
    System.IO.Stream.CopyToAsync(System.IO.Stream, System.Int32)
    System.IO.Stream.CopyToAsync(System.IO.Stream, System.Int32, System.Threading.CancellationToken)
    System.IO.Stream.CopyTo(System.IO.Stream)
    System.IO.Stream.CopyTo(System.IO.Stream, System.Int32)
    System.IO.Stream.Close()
    System.IO.Stream.Dispose()
    System.IO.Stream.FlushAsync()
    System.IO.Stream.FlushAsync(System.Threading.CancellationToken)
    System.IO.Stream.CreateWaitHandle()
    System.IO.Stream.BeginRead(System.Byte[], System.Int32, System.Int32, System.AsyncCallback, System.Object)
    System.IO.Stream.EndRead(System.IAsyncResult)
    System.IO.Stream.ReadAsync(System.Byte[], System.Int32, System.Int32)
    System.IO.Stream.ReadAsync(System.Byte[], System.Int32, System.Int32, System.Threading.CancellationToken)
    System.IO.Stream.BeginWrite(System.Byte[], System.Int32, System.Int32, System.AsyncCallback, System.Object)
    System.IO.Stream.EndWrite(System.IAsyncResult)
    System.IO.Stream.WriteAsync(System.Byte[], System.Int32, System.Int32)
    System.IO.Stream.WriteAsync(System.Byte[], System.Int32, System.Int32, System.Threading.CancellationToken)
    System.IO.Stream.ReadByte()
    System.IO.Stream.WriteByte(System.Byte)
    System.IO.Stream.Synchronized(System.IO.Stream)
    System.IO.Stream.ObjectInvariant()
    System.IO.Stream.CanTimeout
    System.IO.Stream.ReadTimeout
    System.IO.Stream.WriteTimeout
    System.MarshalByRefObject.MemberwiseClone(System.Boolean)
    System.MarshalByRefObject.GetLifetimeService()
    System.MarshalByRefObject.InitializeLifetimeService()
    System.MarshalByRefObject.CreateObjRef(System.Type)
    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.Core.Lib.IO
    Assembly: ImageVault.Core.dll
    Syntax
    public class PartialStream : Stream, IDisposable

    Constructors

    PartialStream(Stream, Int64, Int64)

    Initializes a new instance of the PartialStream class.

    Declaration
    public PartialStream(Stream stream, long start, long length)
    Parameters
    Type Name Description
    System.IO.Stream stream

    The System.IO.Stream to wrap

    System.Int64 start

    The start position of the partial stream

    System.Int64 length

    The length of the partial stream

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    If start is out of range or if length is out of range.

    Properties

    CanRead

    When overridden in a derived class, gets a value indicating whether the current stream supports reading.

    Declaration
    public override bool CanRead { get; }
    Property Value
    Type Description
    System.Boolean
    Overrides
    System.IO.Stream.CanRead

    CanSeek

    When overridden in a derived class, gets a value indicating whether the current stream supports seeking.

    Declaration
    public override bool CanSeek { get; }
    Property Value
    Type Description
    System.Boolean
    Overrides
    System.IO.Stream.CanSeek

    CanWrite

    When overridden in a derived class, gets a value indicating whether the current stream supports writing.

    Declaration
    public override bool CanWrite { get; }
    Property Value
    Type Description
    System.Boolean
    Overrides
    System.IO.Stream.CanWrite

    Length

    Gets the length of the stream.

    Declaration
    public override long Length { get; }
    Property Value
    Type Description
    System.Int64
    Overrides
    System.IO.Stream.Length

    Position

    Gets or sets the current position of the stream.

    Declaration
    public override long Position { get; set; }
    Property Value
    Type Description
    System.Int64
    Overrides
    System.IO.Stream.Position

    Methods

    Dispose(Boolean)

    Releases the resources used by the PartialStream.

    Declaration
    protected override void Dispose(bool disposing)
    Parameters
    Type Name Description
    System.Boolean disposing

    Set to true to release both managed and unmanaged resources; false to release only unmanaged resources.

    Overrides
    System.IO.Stream.Dispose(System.Boolean)

    Flush()

    When overridden in a derived class, clears all buffers for this stream and causes any buffered data to be written to the underlying device.

    Declaration
    public override void Flush()
    Overrides
    System.IO.Stream.Flush()
    Exceptions
    Type Condition
    System.IO.IOException

    An I/O error occurs.

    Read(Byte[], Int32, Int32)

    Reads data from the partial stream

    Declaration
    public override int Read(byte[] buffer, int offset, int count)
    Parameters
    Type Name Description
    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
    Overrides
    System.IO.Stream.Read(System.Byte[], System.Int32, System.Int32)

    Seek(Int64, SeekOrigin)

    Sets the new position in the stream.

    Declaration
    public override long Seek(long offset, SeekOrigin origin)
    Parameters
    Type Name Description
    System.Int64 offset

    A byte offset relative to the origin parameter.

    System.IO.SeekOrigin origin

    A value of type System.IO.SeekOrigin indicating the reference point used to obtain the new position.

    Returns
    Type Description
    System.Int64

    The new position within the current stream.

    Overrides
    System.IO.Stream.Seek(System.Int64, System.IO.SeekOrigin)
    Exceptions
    Type Condition
    System.ApplicationException

    If unable to handle SeekOrigin.

    SetLength(Int64)

    Attempts to set a new length, but since the length of the partial stream was locked when the stream was constructed, this method will throw a System.NotSupportedException exception.

    Declaration
    public override void SetLength(long value)
    Parameters
    Type Name Description
    System.Int64 value

    The new length of the stream. This parameter is ignored.

    Overrides
    System.IO.Stream.SetLength(System.Int64)
    Exceptions
    Type Condition
    System.NotSupportedException

    Thrown in all cases because the length is fixed.

    Write(Byte[], Int32, Int32)

    When overridden in a derived class, writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.

    Declaration
    public override void Write(byte[] buffer, int offset, int count)
    Parameters
    Type Name Description
    System.Byte[] buffer

    An array of bytes. This method copies count bytes from buffer to the current stream.

    System.Int32 offset

    The zero-based byte offset in buffer at which to begin copying bytes to the current stream.

    System.Int32 count

    The number of bytes to be written to the current stream.

    Overrides
    System.IO.Stream.Write(System.Byte[], System.Int32, System.Int32)
    Exceptions
    Type Condition
    System.IO.IOException

    If unable to write to stream, would write past end of partial stream.

    Implements

    System.IDisposable
    In This Article
    Back to top (c) Meriworks 2002-2022