C# Class WebApplications.Utilities.IO.PeekableStream

Inheritance: Stream
ファイルを表示 Open project: webappsuk/CoreLibraries

Public Methods

Method Description
Close ( ) : void

Closes the current stream and releases any resources (such as sockets and file handles) associated with the current stream. Instead of calling this method, ensure that the stream is properly disposed.

CopyToAsync ( [ destination, int bufferSize, CancellationToken cancellationToken ) : Task

Asynchronously reads the bytes from the current stream and writes them to another stream, using a specified buffer size and cancellation token.

CreateObjRef ( Type requestedType ) : ObjRef

Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

Equals ( object obj ) : bool

Determines whether the specified System.Object, is equal to this instance.

Flush ( ) : void

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

FlushAsync ( CancellationToken cancellationToken ) : Task

Asynchronously clears all buffers for this stream, causes any buffered data to be written to the underlying device, and monitors cancellation requests.

GetHashCode ( ) : int

Returns a hash code for this instance.

InitializeLifetimeService ( ) : object

Obtains a lifetime service object to control the lifetime policy for this instance.

PeekByte ( ) : int

Reads a byte from the stream without advancing the position within the stream, or returns -1 if at the end of the stream.

PeekableStream ( [ baseStream ) : System

Initializes a new instance of the PeekableStream class.

Read ( byte buffer, int offset, int count ) : int

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.

ReadAsync ( [ buffer, int offset, int count, CancellationToken cancellationToken ) : Task

Asynchronously reads a sequence of bytes from the current stream, advances the position within the stream by the number of bytes read, and monitors cancellation requests.

ReadByte ( ) : int

Reads a byte from the stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream.

Seek ( long offset, SeekOrigin origin ) : long

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

SetLength ( long value ) : void

When overridden in a derived class, sets the length of the current stream.

ToString ( ) : string

Returns a System.String that represents this instance.

Write ( byte buffer, int offset, int count ) : void

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.

WriteAsync ( byte buffer, int offset, int count, CancellationToken cancellationToken ) : Task

Asynchronously writes a sequence of bytes to the current stream, advances the current position within this stream by the number of bytes written, and monitors cancellation requests.

WriteByte ( byte value ) : void

Writes a byte to the current position in the stream and advances the position within the stream by one byte.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Releases the unmanaged resources used by the T:System.IO.Stream and optionally releases the managed resources.

Method Details

Close() public method

Closes the current stream and releases any resources (such as sockets and file handles) associated with the current stream. Instead of calling this method, ensure that the stream is properly disposed.
public Close ( ) : void
return void

CopyToAsync() public method

Asynchronously reads the bytes from the current stream and writes them to another stream, using a specified buffer size and cancellation token.
public CopyToAsync ( [ destination, int bufferSize, CancellationToken cancellationToken ) : Task
destination [ The stream to which the contents of the current stream will be copied.
bufferSize int The size, in bytes, of the buffer. This value must be greater than zero. The default size is 81920.
cancellationToken System.Threading.CancellationToken The token to monitor for cancellation requests. The default value is .
return Task

CreateObjRef() public method

Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.
public CreateObjRef ( Type requestedType ) : ObjRef
requestedType System.Type The of the object that the new will reference.
return System.Runtime.Remoting.ObjRef

Dispose() protected method

Releases the unmanaged resources used by the T:System.IO.Stream and optionally releases the managed resources.
protected Dispose ( bool disposing ) : void
disposing bool true to release both managed and unmanaged resources; false to release only unmanaged resources.
return void

Equals() public method

Determines whether the specified System.Object, is equal to this instance.
public Equals ( object obj ) : bool
obj object The to compare with this instance.
return bool

Flush() public method

When overridden in a derived class, clears all buffers for this stream and causes any buffered data to be written to the underlying device.
public Flush ( ) : void
return void

FlushAsync() public method

Asynchronously clears all buffers for this stream, causes any buffered data to be written to the underlying device, and monitors cancellation requests.
public FlushAsync ( CancellationToken cancellationToken ) : Task
cancellationToken System.Threading.CancellationToken The token to monitor for cancellation requests. The default value is .
return Task

GetHashCode() public method

Returns a hash code for this instance.
public GetHashCode ( ) : int
return int

InitializeLifetimeService() public method

Obtains a lifetime service object to control the lifetime policy for this instance.
public InitializeLifetimeService ( ) : object
return object

PeekByte() public method

Reads a byte from the stream without advancing the position within the stream, or returns -1 if at the end of the stream.
public PeekByte ( ) : int
return int

PeekableStream() public method

Initializes a new instance of the PeekableStream class.
public PeekableStream ( [ baseStream ) : System
baseStream [ The base stream.
return System

Read() public method

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.
public Read ( byte buffer, int offset, int count ) : int
buffer byte An array of bytes. When this method returns, the buffer contains the specified byte array with the values between and ( + - 1) replaced by the bytes read from the current source.
offset int The zero-based byte offset in at which to begin storing the data read from the current stream.
count int The maximum number of bytes to be read from the current stream.
return int

ReadAsync() public method

Asynchronously reads a sequence of bytes from the current stream, advances the position within the stream by the number of bytes read, and monitors cancellation requests.
public ReadAsync ( [ buffer, int offset, int count, CancellationToken cancellationToken ) : Task
buffer [ The buffer to write the data into.
offset int The byte offset in at which to begin writing data from the stream.
count int The maximum number of bytes to read.
cancellationToken System.Threading.CancellationToken The token to monitor for cancellation requests. The default value is .
return Task

ReadByte() public method

Reads a byte from the stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream.
public ReadByte ( ) : int
return int

Seek() public method

When overridden in a derived class, sets the position within the current stream.
public Seek ( long offset, SeekOrigin origin ) : long
offset long A byte offset relative to the parameter.
origin SeekOrigin A value of type indicating the reference point used to obtain the new position.
return long

SetLength() public method

When overridden in a derived class, sets the length of the current stream.
public SetLength ( long value ) : void
value long The desired length of the current stream in bytes.
return void

ToString() public method

Returns a System.String that represents this instance.
public ToString ( ) : string
return string

Write() public method

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.
public Write ( byte buffer, int offset, int count ) : void
buffer byte An array of bytes. This method copies bytes from to the current stream.
offset int The zero-based byte offset in at which to begin copying bytes to the current stream.
count int The number of bytes to be written to the current stream.
return void

WriteAsync() public method

Asynchronously writes a sequence of bytes to the current stream, advances the current position within this stream by the number of bytes written, and monitors cancellation requests.
public WriteAsync ( byte buffer, int offset, int count, CancellationToken cancellationToken ) : Task
buffer byte The buffer to write data from.
offset int The zero-based byte offset in from which to begin copying bytes to the stream.
count int The maximum number of bytes to write.
cancellationToken System.Threading.CancellationToken The token to monitor for cancellation requests. The default value is .
return Task

WriteByte() public method

Writes a byte to the current position in the stream and advances the position within the stream by one byte.
public WriteByte ( byte value ) : void
value byte The byte to write to the stream.
return void