Class NullStream
A
Namespace: ICSharpCode.SharpZipLib.Tests.TestSupport
Syntax
public class NullStream : Stream
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 |
|---|---|
| Boolean |
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 |
|---|---|
| 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 |
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
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 |
| Int32 | offset | The zero-based byte offset in |
| 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 |
| ArgumentNullException |
|
| ArgumentOutOfRangeException |
|
| 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)
When overridden in a derived class, sets the position within the current stream.
Declaration
public override long Seek(long offset, SeekOrigin origin)
Parameters
| Type | Name | Description |
|---|---|---|
| Int64 | offset | A byte offset relative to the |
| SeekOrigin | origin | A value of type SeekOrigin indicating the reference point used to obtain the new position. |
Returns
| Type | Description |
|---|---|
| Int64 | The new position within the current stream. |
Exceptions
| Type | Condition |
|---|---|
| IOException | An I/O error occurs. |
| NotSupportedException | The stream does not support seeking, such as if the stream is constructed from a pipe or console output. |
| ObjectDisposedException | Methods were called after the stream was closed. |
SetLength(Int64)
When overridden in a derived class, sets the length of the current stream.
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 |
|---|---|
| IOException | An I/O error occurs. |
| NotSupportedException | The stream does not support both writing and seeking, such as if the stream is constructed from a pipe or console output. |
| ObjectDisposedException | Methods were called after the stream was closed. |
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 |
|---|---|---|
| Byte[] | buffer | An array of bytes. This method copies |
| Int32 | offset | The zero-based byte offset in |
| Int32 | count | The number of bytes to be written to the current stream. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | The sum of |
| ArgumentNullException |
|
| ArgumentOutOfRangeException |
|
| IOException | An I/O error occurs. |
| NotSupportedException | The stream does not support writing. |
| ObjectDisposedException | Methods were called after the stream was closed. |