Binary

Overview

The Binary class is used to represent binary data that is sent between client and server. The Binary class extends the System.IO.MemoryStream class to add some helper methods for working with Binaries.

Location


Instance Methods


constructor

 

constructor

 

Binary()

 

Sub New()

constructor (array of Byte)

 

constructor(buffer: array of Byte)

 

Binary(Byte[] buffer)

 

Sub New(buffer As Byte())

Parameters:

  • buffer:

constructor (String)

 

constructor(buffer: String)

 

Binary(String buffer)

 

Sub New(buffer As String)

Parameters:

  • buffer:

LoadFromStream (Stream)

Loads the Binary by reading data from the given stream. The Position of the Binary will be reset before the load and the entire data in the Binary will be replaced with the data from the passed stream.

 

method LoadFromStream(stream: Stream)

 

void LoadFromStream(Stream stream)

 

Sub LoadFromStream(stream As Stream)

Parameters:

  • stream:

LoadFromStream (Stream, Int32)

 

method LoadFromStream(stream: Stream; count: Int32)

 

void LoadFromStream(Stream stream, Int32 count)

 

Sub LoadFromStream(stream As Stream, count As Int32)

Parameters:

  • stream:
  • count:

LoadFromString (String)

Uses aValue to load the stream from a string by converting it to a byte array before writing it to the stream using thr provided encoding aEncoding. This method is overloaded. An overloaded method has no aEncoding parameter and used ASCII by default. The string representation of the Binary can be accessed via the ToString() method.

 

method LoadFromString(value: String)

 

void LoadFromString(String value)

 

Sub LoadFromString(value As String)

Parameters:

  • value:

LoadFromString (String, Encoding)

 

method LoadFromString(value: String; encoding: Encoding)

 

void LoadFromString(String value, Encoding encoding)

 

Sub LoadFromString(value As String, encoding As Encoding)

Parameters:

  • value:
  • encoding:

Read

Reads a block of bytes from the current stream and writes the data to the buffer. Returns the really read count of bytes.

 

method Read(buffer: array of Byte; count: Int32): Int32

 

Int32 Read(Byte[] buffer, Int32 count)

 

Function Read(buffer As Byte(), count As Int32) As Int32

Parameters:

  • buffer:
  • count:

ReadFromStream (Stream)

Reads all the binary data from another aStream stream with the CopyFromStreamToStream method of StreamHelpers class.

 

method ReadFromStream(stream: Stream)

 

void ReadFromStream(Stream stream)

 

Sub ReadFromStream(stream As Stream)

Parameters:

  • stream:

ReadFromStream (Stream, Int32)

Reads a maximum of aCount bytes from aStream.

 

method ReadFromStream(stream: Stream; count: Int32)

 

void ReadFromStream(Stream stream, Int32 count)

 

Sub ReadFromStream(stream As Stream, count As Int32)

Parameters:

  • stream:
  • count:

SaveToStream

Saves the entire data from the Binary to the given aStream stream.

 

method SaveToStream(stream: Stream)

 

void SaveToStream(Stream stream)

 

Sub SaveToStream(stream As Stream)

Parameters:

  • stream:

ToString

Overrides Object.ToString() to return a string representation of the stream. This conversion is done using the StreamToString() method in the StreamHelpers. A Binary instance can be loaded from a string using the LoadFromString() method or via the overloaded constructor.

 

method ToString: String

 

String ToString()

 

Function ToString() As String

Write

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

 

method Write(buffer: array of Byte; count: Int32)

 

void Write(Byte[] buffer, Int32 count)

 

Sub Write(buffer As Byte(), count As Int32)

Parameters:

  • buffer:
  • count: