Show / Hide Table of Contents

Class BinaryMemoryStream

A System.IO.MemoryStream implementation whose primary purpose is to be used to create Binary objects.

Inheritance
System.Object
System.IO.Stream
System.IO.MemoryStream
BinaryMemoryStream
Implements
System.IDisposable
Inherited Members
System.IO.MemoryStream.CopyToAsync(System.IO.Stream, System.Int32, System.Threading.CancellationToken)
System.IO.MemoryStream.Dispose(System.Boolean)
System.IO.MemoryStream.Flush()
System.IO.MemoryStream.FlushAsync(System.Threading.CancellationToken)
System.IO.MemoryStream.Read(System.Byte[], System.Int32, System.Int32)
System.IO.MemoryStream.ReadAsync(System.Byte[], System.Int32, System.Int32, System.Threading.CancellationToken)
System.IO.MemoryStream.ReadByte()
System.IO.MemoryStream.Seek(System.Int64, System.IO.SeekOrigin)
System.IO.MemoryStream.ToArray()
System.IO.MemoryStream.TryGetBuffer(System.ArraySegment<System.Byte>)
System.IO.MemoryStream.WriteAsync(System.Byte[], System.Int32, System.Int32, System.Threading.CancellationToken)
System.IO.MemoryStream.WriteTo(System.IO.Stream)
System.IO.MemoryStream.CanRead
System.IO.MemoryStream.CanSeek
System.IO.MemoryStream.Capacity
System.IO.MemoryStream.Length
System.IO.MemoryStream.Position
System.IO.Stream.Null
System.IO.Stream.CopyTo(System.IO.Stream)
System.IO.Stream.CopyTo(System.IO.Stream, System.Int32)
System.IO.Stream.CopyToAsync(System.IO.Stream)
System.IO.Stream.CopyToAsync(System.IO.Stream, System.Int32)
System.IO.Stream.Dispose()
System.IO.Stream.FlushAsync()
System.IO.Stream.ReadAsync(System.Byte[], System.Int32, System.Int32)
System.IO.Stream.WriteAsync(System.Byte[], System.Int32, System.Int32)
System.IO.Stream.CanTimeout
System.IO.Stream.ReadTimeout
System.IO.Stream.WriteTimeout
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Tangosol.Util
Assembly: Coherence.Core.dll
Syntax
public sealed class BinaryMemoryStream : MemoryStream, IDisposable

Constructors

| Improve this Doc View Source

BinaryMemoryStream()

Initializes a new instance of the BinaryMemoryStream with an expandable capacity initialized to zero.

Declaration
public BinaryMemoryStream()
| Improve this Doc View Source

BinaryMemoryStream(Int32)

Initializes a new instance of the BinaryMemoryStream with an expandable capacity initialized as specified.

Declaration
public BinaryMemoryStream(int capacity)
Parameters
Type Name Description
System.Int32 capacity

The initial size of the internal array in bytes.

Exceptions
Type Condition
System.ArgumentOutOfRangeException

Capacity is negative.

Properties

| Improve this Doc View Source

CanWrite

Gets a value indicating whether the current stream supports writing.

Declaration
public override bool CanWrite { get; }
Property Value
Type Description
System.Boolean

true if the stream supports writing; otherwise, false.

Overrides
System.IO.MemoryStream.CanWrite

Methods

| Improve this Doc View Source

GetBuffer()

Returns the array of unsigned bytes from which this stream was created.

Declaration
public override byte[] GetBuffer()
Returns
Type Description
System.Byte[]

The byte array from which this stream was created.

Exceptions
Type Condition
System.UnauthorizedAccessException

Buffer is not publicly visible.

| Improve this Doc View Source

SetLength(Int64)

Sets the length of the current stream to the specified value.

Declaration
public override void SetLength(long value)
Parameters
Type Name Description
System.Int64 value

The value at which to set the length.

Overrides
System.IO.MemoryStream.SetLength(System.Int64)
Exceptions
Type Condition
System.NotSupportedException

The current stream is not resizable and value is larger than the current capacity or the current stream does not support writing.

System.ArgumentOutOfRangeException

Value is negative or is greater than the maximum length of the stream, where the maximum length is (System.Int32.MaxValue - origin), and origin is the index into the underlying buffer at which the stream starts.

| Improve this Doc View Source

ToBinary()

Returns a new Binary object that holds the complete contents of this stream.

Declaration
public Binary ToBinary()
Returns
Type Description
Binary

The contents of this stream as a Binary object.

| Improve this Doc View Source

Write(Byte[], Int32, Int32)

Writes a block of bytes to the current stream using data read from buffer.

Declaration
public override void Write(byte[] buffer, int offset, int count)
Parameters
Type Name Description
System.Byte[] buffer

The buffer to write data from.

System.Int32 offset

The byte offset in buffer at which to begin writing from.

System.Int32 count

The maximum number of bytes to write.

Overrides
System.IO.MemoryStream.Write(System.Byte[], System.Int32, System.Int32)
Exceptions
Type Condition
System.ArgumentNullException

Buffer is null.

System.NotSupportedException

The stream does not support writing or the current position is closer than count bytes to the end of the stream, and the capacity cannot be modified.

System.ArgumentException

Offset subtracted from the buffer length is less than count.

System.ArgumentOutOfRangeException

Offset or count are negative.

System.IO.IOException

An I/O error occurs.

System.ObjectDisposedException

The current stream instance is closed.

| Improve this Doc View Source

WriteByte(Byte)

Writes a byte to the current stream at the current position.

Declaration
public override void WriteByte(byte value)
Parameters
Type Name Description
System.Byte value

The byte to write.

Overrides
System.IO.MemoryStream.WriteByte(System.Byte)
Exceptions
Type Condition
System.NotSupportedException

The stream does not support writing or the current position is at the end of the stream, and the capacity cannot be modified.

System.ObjectDisposedException

The current stream is closed.

Implements

System.IDisposable
  • Improve this Doc
  • View Source
In This Article
Back to top Copyright © 2000, 2020, Oracle and/or its affiliates. All rights reserved.