docs.unity3d.com
    Show / Hide Table of Contents

    Class WindowedStream

    A that supports reading and writing from a fixed size memory buffer. This provides the ability to test writing and reading from very large streams without using any disk storeage

    Inheritance
    Object
    WindowedStream
    Namespace: ICSharpCode.SharpZipLib.Tests.TestSupport
    Syntax
    public class WindowedStream : Stream

    Constructors

    WindowedStream(Int32, Nullable<CancellationToken>)

    Initializes a new instance of the WindowedStream class.

    Declaration
    public WindowedStream(int size, CancellationToken? token = null)
    Parameters
    Type Name Description
    Int32 size

    The size.

    Nullable<CancellationToken> token

    Properties

    BytesRead

    Gets the bytes read.

    Declaration
    public long BytesRead { get; }
    Property Value
    Type Description
    Int64

    The bytes read.

    BytesWritten

    Gets the bytes written.

    Declaration
    public long BytesWritten { get; }
    Property Value
    Type Description
    Int64

    The bytes written.

    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
    Boolean
    Remarks

    If the stream is closed, this property returns false.

    CanSeek

    Gets a value indicating whether the current stream supports seeking.

    Declaration
    public override bool CanSeek { get; }
    Property Value
    Type Description
    Boolean

    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
    Boolean
    Remarks

    If the stream is closed, this property returns false.

    IsClosed

    Gets a value indicating whether this instance is closed.

    Declaration
    public bool IsClosed { get; }
    Property Value
    Type Description
    Boolean

    true if this instance is closed; otherwise, false.

    Length

    When overridden in a derived class, gets the length in bytes of the stream.

    Declaration
    public override long Length { get; }
    Property Value
    Type Description
    Int64
    Exceptions
    Type Condition
    NotSupportedException

    A class derived from Stream does not support seeking.

    ObjectDisposedException

    Methods were called after the stream was closed.

    Position

    When overridden in a derived class, gets or sets the position within the current stream.

    Declaration
    public override long Position { get; set; }
    Property Value
    Type Description
    Int64
    Exceptions
    Type Condition
    IOException

    An I/O error occurs.

    NotSupportedException

    The stream does not support seeking.

    ObjectDisposedException

    Methods were called after the stream was closed.

    Methods

    Dispose(Boolean)

    Releases the unmanaged resources used by the and optionally releases the managed resources.

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

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

    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()
    Exceptions
    Type Condition
    IOException

    An I/O error occurs.

    Read(Byte[], Int32, Int32)

    When overridden in a derived class, reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.

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

    Int32 offset

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

    Int32 count

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

    Returns
    Type Description
    Int32

    The total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available, or zero (0) if the end of the stream has been reached.

    Exceptions
    Type Condition
    ArgumentException

    The sum of offset and count is larger than the buffer length.

    ArgumentNullException

    buffer is null.

    ArgumentOutOfRangeException

    offset or count is negative.

    IOException

    An I/O error occurs.

    NotSupportedException

    The stream does not support reading.

    ObjectDisposedException

    Methods were called after the stream was closed.

    Seek(Int64, SeekOrigin)

    Not supported, throws NotSupportedException.

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

    A byte offset relative to the origin parameter.

    SeekOrigin origin

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

    Returns
    Type Description
    Int64
    Exceptions
    Type Condition
    NotSupportedException

    The stream does not support seeking, such as if the stream is constructed from a pipe or console output.

    SetLength(Int64)

    Not supported, throws NotSupportedException.

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

    The desired length of the current stream in bytes.

    Exceptions
    Type Condition
    NotSupportedException

    The stream does not support both writing and seeking, such as if the stream is constructed from a pipe or console output.

    Write(Byte[], Int32, Int32)

    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
    Byte[] buffer

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

    Int32 offset

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

    Int32 count

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

    Exceptions
    Type Condition
    ArgumentException

    The sum of offset and count is greater than the buffer length.

    ArgumentNullException

    buffer is null.

    ArgumentOutOfRangeException

    offset or count is negative.

    IOException

    An I/O error occurs.

    NotSupportedException

    The stream does not support writing.

    ObjectDisposedException

    Methods were called after the stream was closed.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023