DumpableStream
Represents a stream wrapper that records all data read from and written to the underlying stream.
继承自: Stream
构造函数
public DumpableStream(Stream underlying, bool leaveOpen)
dumpableStream = DumpableStream(underlying, leaveOpen)
Represents a stream wrapper that records all data read from and written to the underlying stream.
- underlying
- The underlying stream to wrap.
- leaveOpen
- true to leave the underlying stream open after disposing; otherwise, false.
属性
public override bool CanRead { get; }
value = dumpableStream.CanRead
Gets a value indicating whether the current stream supports reading.
public override bool CanSeek { get; }
value = dumpableStream.CanSeek
Gets a value indicating whether the current stream supports seeking.
public override bool CanWrite { get; }
value = dumpableStream.CanWrite
Gets a value indicating whether the current stream supports writing.
public override long Length { get; }
value = dumpableStream.Length
Gets the length in bytes of the stream.
public override long Position { get; set; }
value = dumpableStream.Position
dumpableStream.Position = value
Gets or sets the position within the current stream.
public AllocationArray<byte> ReadDump { get; }
value = dumpableStream.ReadDump
Gets the allocation array that collects data read from the underlying stream.
public AllocationArray<byte> WriteDump { get; }
value = dumpableStream.WriteDump
Gets the allocation array that collects data written to the underlying stream.
方法
protected override void Dispose(bool disposing)
dumpableStream.Dispose(disposing)
Disposes the command resources.
- disposing
- True if disposing managed resources.
public override void Flush()
dumpableStream.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.
public byte[] GetReadDump()
result = dumpableStream.GetReadDump()
Retrieves and clears the dump of data read from the underlying stream.
返回值: A byte array containing the dumped read data.
public byte[] GetWriteDump()
result = dumpableStream.GetWriteDump()
Retrieves and clears the dump of data written to the underlying stream.
返回值: A byte array containing the dumped write data.
public override int Read(byte[] buffer, int offset, int count)
result = dumpableStream.Read(buffer, offset, count)
Reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.
- buffer
- 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
- The zero-based byte offset in at which to begin storing the data read from the current stream.
- count
- The maximum number of bytes to be read from the current stream.
返回值: The total number of bytes read into the buffer.
public override long Seek(long offset, SeekOrigin origin)
result = dumpableStream.Seek(offset, origin)
When overridden in a derived class, sets the position within the current stream.
- offset
- A byte offset relative to the parameter.
- origin
- A value of type SeekOrigin indicating the reference point used to obtain the new position.
返回值: The new position within the current stream.
public override void SetLength(long value)
dumpableStream.SetLength(value)
When overridden in a derived class, sets the length of the current stream.
- value
- The desired length of the current stream in bytes.
public override void Write(byte[] buffer, int offset, int count)
dumpableStream.Write(buffer, offset, count)
Writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.
- buffer
- An array of bytes. This method copies bytes from to the current stream.
- offset
- The zero-based byte offset in at which to begin copying bytes to the current stream.
- count
- The number of bytes to be written to the current stream.