Class ShieldedStream
Proxy stream that prevents the underlying stream from being closed.
Inherited Members
Namespace: Tangosol.Util
Assembly: Coherence.dll
Syntax
public class ShieldedStream : Stream, IAsyncDisposable, IDisposable
Constructors
ShieldedStream(Stream)
Constructs a wrapper around underlying stream that should be shielded.
Declaration
public ShieldedStream(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | Underlying stream. |
Properties
CanRead
Gets a value indicating whether the current stream supports reading.
Declaration
public override bool CanRead { get; }
Property Value
Type | Description |
---|---|
bool | true if the stream supports reading; otherwise, false. |
Overrides
CanSeek
Gets a value indicating whether the current stream supports seeking.
Declaration
public override bool CanSeek { get; }
Property Value
Type | Description |
---|---|
bool | true if the stream supports seeking; otherwise, false. |
Overrides
CanWrite
Gets a value indicating whether the current stream supports writing.
Declaration
public override bool CanWrite { get; }
Property Value
Type | Description |
---|---|
bool | true if the stream supports writing; otherwise, false. |
Overrides
Length
Gets the length in bytes of the stream.
Declaration
public override long Length { get; }
Property Value
Type | Description |
---|---|
long | A long value representing the length of the stream in bytes. |
Overrides
Position
Gets or sets the position within the current stream.
Declaration
public override long Position { get; set; }
Property Value
Type | Description |
---|---|
long | The current position within the stream. |
Overrides
Methods
BeginRead(byte[], int, int, AsyncCallback, object)
Begins an asynchronous read operation.
Declaration
public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
Parameters
Type | Name | Description |
---|---|---|
byte[] | buffer | The buffer to read the data into. |
int | offset | The byte offset in buffer at which to begin writing data read from the stream. |
int | count | The maximum number of bytes to read. |
AsyncCallback | callback | An optional asynchronous callback, to be called when the read is complete. |
object | state | A user-provided object that distinguishes this particular asynchronous read request from other requests. |
Returns
Type | Description |
---|---|
IAsyncResult | An IAsyncResult that represents the asynchronous read, which could still be pending. |
Overrides
BeginWrite(byte[], int, int, AsyncCallback, object)
Begins an asynchronous write operation.
Declaration
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
Parameters
Type | Name | Description |
---|---|---|
byte[] | buffer | The buffer to write data from. |
int | offset | The byte offset in buffer from which to begin writing. |
int | count | The maximum number of bytes to write. |
AsyncCallback | callback | An optional asynchronous callback, to be called when the write is complete. |
object | state | A user-provided object that distinguishes this particular asynchronous write request from other requests. |
Returns
Type | Description |
---|---|
IAsyncResult | An IAsyncResult that represents the asynchronous write, which could still be pending. |
Overrides
Close()
Overriden method that prevents underlying stream from being closed.
Declaration
public override void Close()
Overrides
EndRead(IAsyncResult)
Waits for the pending asynchronous read to complete.
Declaration
public override int EndRead(IAsyncResult asyncResult)
Parameters
Type | Name | Description |
---|---|---|
IAsyncResult | asyncResult | The reference to the pending asynchronous request to finish. |
Returns
Type | Description |
---|---|
int | The number of bytes read from the stream, between zero (0) and the number of bytes you requested. Streams return zero (0) only at the end of the stream, otherwise, they should block until at least one byte is available. |
Overrides
EndWrite(IAsyncResult)
Ends an asynchronous write operation.
Declaration
public override void EndWrite(IAsyncResult asyncResult)
Parameters
Type | Name | Description |
---|---|---|
IAsyncResult | asyncResult | A reference to the outstanding asynchronous I/O request. |
Overrides
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()
Overrides
Read(byte[], int, int)
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. |
int | offset | The zero-based byte offset in buffer at which to begin storing the data read from the current stream. |
int | count | The maximum number of bytes to be read from the current stream. |
Returns
Type | Description |
---|---|
int | 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. |
Overrides
ReadByte()
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.
Declaration
public override int ReadByte()
Returns
Type | Description |
---|---|
int | The unsigned byte cast to an Int32, or -1 if at the end of the stream. |
Overrides
Seek(long, SeekOrigin)
Sets the position within the current stream.
Declaration
public override long Seek(long offset, SeekOrigin origin)
Parameters
Type | Name | Description |
---|---|---|
long | 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 |
---|---|
long | The new position within the current stream. |
Overrides
SetLength(long)
Sets the length of the current stream.
Declaration
public override void SetLength(long value)
Parameters
Type | Name | Description |
---|---|---|
long | value | The desired length of the current stream in bytes. |
Overrides
Write(byte[], int, int)
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. |
int | offset | The zero-based byte offset in buffer at which to begin copying bytes to the current stream. |
int | count | The number of bytes to be written to the current stream. |
Overrides
WriteByte(byte)
Writes a byte to the current position in the stream and advances the position within the stream by one byte.
Declaration
public override void WriteByte(byte value)
Parameters
Type | Name | Description |
---|---|---|
byte | value | The byte to write to the stream. |