C# Class WebApplications.Utilities.IO.PeekableStream

Inheritance: Stream
Afficher le fichier Open project: webappsuk/CoreLibraries

Méthodes publiques

Méthode 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.

Méthodes protégées

Méthode 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 méthode

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
Résultat void

CopyToAsync() public méthode

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 .
Résultat Task

CreateObjRef() public méthode

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.
Résultat System.Runtime.Remoting.ObjRef

Dispose() protected méthode

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.
Résultat void

Equals() public méthode

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

Flush() public méthode

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
Résultat void

FlushAsync() public méthode

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 .
Résultat Task

GetHashCode() public méthode

Returns a hash code for this instance.
public GetHashCode ( ) : int
Résultat int

InitializeLifetimeService() public méthode

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

PeekByte() public méthode

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
Résultat int

PeekableStream() public méthode

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

Read() public méthode

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.
Résultat int

ReadAsync() public méthode

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 .
Résultat Task

ReadByte() public méthode

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
Résultat int

Seek() public méthode

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.
Résultat long

SetLength() public méthode

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.
Résultat void

ToString() public méthode

Returns a System.String that represents this instance.
public ToString ( ) : string
Résultat string

Write() public méthode

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.
Résultat void

WriteAsync() public méthode

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 .
Résultat Task

WriteByte() public méthode

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.
Résultat void