Open Rails

BufferedInMemoryStream Class

[This is preliminary documentation and subject to change.]

A Stream which buffers both reads and writes in memory (as a MemoryStream).

For a list of all members of this type, see BufferedInMemoryStream Members .

System.Object
   MarshalByRefObject
      Stream
         BufferedInMemoryStream

public class BufferedInMemoryStream : Stream

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

Treat this stream like any other; Read, Write, Seek all work normally (or close enough) in most cases. There are some specific exceptions, which shouldn't be a problem normally, outlined below.

When reading, if the underlying stream does not report a length itself, the value reported by Length represents the amount buffered. The BufferedInMemoryStream attempts to keep the Length beyond the current seek location at all times.

when reading, Seek will operate normally but only within the data already buffered; attempts to seek beyond this will raise an exception. There is no way to force a certain amount of data to be buffered.

When writing, Flush is a no-op and SetLength is not implemented. None of the Stream methods and properties will cause data to be written to the underlying stream.

When writing, to cause all buffered data to be written to the underlying stream, call RealFlush. This non-standard behavior is due to unfortunate existing code which calls Flush after writing to a Stream, which would otherwise cause us a problem with write-once underlying streams (which we're specifically trying to support here).

Requirements

Namespace: ORTS.IO

Assembly: ORTS.IO (in ORTS.IO.dll)

See Also

BufferedInMemoryStream Members | ORTS.IO Namespace