C# Class RockSmithTabExplorer.Utils.NonClosingStreamWrapper

Wraps a stream for all operations except Close and Dispose, which merely flush the stream and prevent further operations from being carried out using this wrapper.
Inheritance: Stream
Show file Open project: Jamedjo/RSTabExplorer Class Usage Examples

Public Methods

Method Description
BeginRead ( byte buffer, int offset, int count, AsyncCallback callback, object state ) : IAsyncResult

Begins an asynchronous read operation.

BeginWrite ( byte buffer, int offset, int count, AsyncCallback callback, object state ) : IAsyncResult

Begins an asynchronous write operation.

Close ( ) : void

This method is not proxied to the underlying stream; instead, the stream is "rewinded" (seek to beginning)

CreateObjRef ( Type requestedType ) : ObjRef

Throws a NotSupportedException.

EndRead ( IAsyncResult asyncResult ) : int

Waits for the pending asynchronous read to complete.

EndWrite ( IAsyncResult asyncResult ) : void

Ends an asynchronous write operation.

Flush ( ) : void

Flushes the underlying stream.

InitializeLifetimeService ( ) : object

Throws a NotSupportedException.

NonClosingStreamWrapper ( Stream stream ) : System

Creates a new instance of the class, wrapping the specified stream.

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

Reads a sequence of bytes from the underlying stream and advances the position within the stream by the number of bytes read.

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

Sets the position within the current stream.

SetLength ( long value ) : void

Sets the length of the underlying stream.

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

Writes a sequence of bytes to the underlying stream and advances the current position within the stream by the number of bytes written.

WriteByte ( byte value ) : void

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

Method Details

BeginRead() public method

Begins an asynchronous read operation.
public BeginRead ( byte buffer, int offset, int count, AsyncCallback callback, object state ) : IAsyncResult
buffer byte The buffer to read the data into.
offset int /// The byte offset in buffer at which to begin writing data read from the stream. ///
count int The maximum number of bytes to read.
callback AsyncCallback /// An optional asynchronous callback, to be called when the read is complete. ///
state object /// A user-provided object that distinguishes this particular /// asynchronous read request from other requests. ///
return IAsyncResult

BeginWrite() public method

Begins an asynchronous write operation.
public BeginWrite ( byte buffer, int offset, int count, AsyncCallback callback, object state ) : IAsyncResult
buffer byte The buffer to write data from.
offset int The byte offset in buffer from which to begin writing.
count int The maximum number of bytes to write.
callback AsyncCallback /// An optional asynchronous callback, to be called when the write is complete. ///
state object /// A user-provided object that distinguishes this particular asynchronous /// write request from other requests. ///
return IAsyncResult

Close() public method

This method is not proxied to the underlying stream; instead, the stream is "rewinded" (seek to beginning)
public Close ( ) : void
return void

CreateObjRef() public method

Throws a NotSupportedException.
public CreateObjRef ( Type requestedType ) : ObjRef
requestedType System.Type The Type of the object that the new ObjRef will reference.
return System.Runtime.Remoting.ObjRef

EndRead() public method

Waits for the pending asynchronous read to complete.
public EndRead ( IAsyncResult asyncResult ) : int
asyncResult IAsyncResult /// The reference to the pending asynchronous request to finish. ///
return int

EndWrite() public method

Ends an asynchronous write operation.
public EndWrite ( IAsyncResult asyncResult ) : void
asyncResult IAsyncResult A reference to the outstanding asynchronous I/O request.
return void

Flush() public method

Flushes the underlying stream.
public Flush ( ) : void
return void

InitializeLifetimeService() public method

Throws a NotSupportedException.
public InitializeLifetimeService ( ) : object
return object

NonClosingStreamWrapper() public method

Creates a new instance of the class, wrapping the specified stream.
stream is null
public NonClosingStreamWrapper ( Stream stream ) : System
stream Stream The stream to wrap. Must not be null.
return System

Read() public method

Reads a sequence of bytes from the underlying 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 offset and /// (offset + count- 1) replaced by the bytes read from the underlying source. ///
offset int /// The zero-based byte offset in buffer at which to begin storing the data /// read from the underlying stream. ///
count int /// The maximum number of bytes to be read from the /// underlying stream. ///
return int

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

Sets the position within the current stream.
public Seek ( long offset, SeekOrigin origin ) : long
offset long A byte offset relative to the origin parameter.
origin SeekOrigin /// A value of type SeekOrigin indicating the reference /// point used to obtain the new position. ///
return long

SetLength() public method

Sets the length of the underlying stream.
public SetLength ( long value ) : void
value long The desired length of the underlying stream in bytes.
return void

Write() public method

Writes a sequence of bytes to the underlying stream and advances the current position within the 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 count bytes /// from buffer to the underlying stream. ///
offset int /// The zero-based byte offset in buffer at /// which to begin copying bytes to the underlying stream. ///
count int The number of bytes to be written to the underlying stream.
return void

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