Show / Hide Table of Contents

Class ErlOutputStream

Provides a stream for encoding Erlang terms to external format for transmission or storage

Inheritance
System.Object
System.MarshalByRefObject
System.IO.Stream
ErlOutputStream
Implements
System.IDisposable
Inherited Members
System.IO.Stream.Null
System.IO.Stream.BeginRead(System.Byte[], System.Int32, System.Int32, System.AsyncCallback, System.Object)
System.IO.Stream.BeginWrite(System.Byte[], System.Int32, System.Int32, System.AsyncCallback, System.Object)
System.IO.Stream.Close()
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.CopyToAsync(System.IO.Stream, System.Int32, System.Threading.CancellationToken)
System.IO.Stream.CreateWaitHandle()
System.IO.Stream.Dispose()
System.IO.Stream.Dispose(System.Boolean)
System.IO.Stream.EndRead(System.IAsyncResult)
System.IO.Stream.EndWrite(System.IAsyncResult)
System.IO.Stream.FlushAsync()
System.IO.Stream.FlushAsync(System.Threading.CancellationToken)
System.IO.Stream.ObjectInvariant()
System.IO.Stream.ReadAsync(System.Byte[], System.Int32, System.Int32)
System.IO.Stream.ReadAsync(System.Byte[], System.Int32, System.Int32, System.Threading.CancellationToken)
System.IO.Stream.ReadByte()
System.IO.Stream.Synchronized(System.IO.Stream)
System.IO.Stream.WriteAsync(System.Byte[], System.Int32, System.Int32)
System.IO.Stream.WriteAsync(System.Byte[], System.Int32, System.Int32, System.Threading.CancellationToken)
System.IO.Stream.WriteByte(System.Byte)
System.IO.Stream.CanTimeout
System.IO.Stream.ReadTimeout
System.IO.Stream.WriteTimeout
System.MarshalByRefObject.GetLifetimeService()
System.MarshalByRefObject.InitializeLifetimeService()
System.MarshalByRefObject.MemberwiseClone(System.Boolean)
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: NFX.Erlang
Assembly: NFX.Erlang.dll
Syntax
public class ErlOutputStream : Stream, IDisposable

Constructors

ErlOutputStream(IErlObject, Boolean, Boolean, Int32)

Create a stream containing the serialized Erlang term. Optionally include in the beginning Erlang protocol version byte

Declaration
public ErlOutputStream(IErlObject o = null, bool writeVersion = true, bool writePktSize = false, int capacity = 2048)
Parameters
Type Name Description
IErlObject o
System.Boolean writeVersion
System.Boolean writePktSize
System.Int32 capacity

Properties

CanRead

Declaration
public override bool CanRead { get; }
Property Value
Type Description
System.Boolean
Overrides
System.IO.Stream.CanRead

CanSeek

Declaration
public override bool CanSeek { get; }
Property Value
Type Description
System.Boolean
Overrides
System.IO.Stream.CanSeek

CanWrite

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

Capacity

Get the current capacity of the stream. As bytes are added the capacity of the stream is increased automatically, however this method returns the current size

Declaration
public int Capacity { get; }
Property Value
Type Description
System.Int32

Length

Get the number of bytes in the stream

Declaration
public override long Length { get; }
Property Value
Type Description
System.Int64
Overrides
System.IO.Stream.Length

Position

Get the current position in the stream

Declaration
public override long Position { get; set; }
Property Value
Type Description
System.Int64
Overrides
System.IO.Stream.Position

Methods

EncodeSize(IErlObject)

Declaration
public static int EncodeSize(IErlObject o)
Parameters
Type Name Description
IErlObject o
Returns
Type Description
System.Int32

Flush()

Declaration
public override void Flush()
Overrides
System.IO.Stream.Flush()

GetBuffer()

Get internal buffer

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

InputStream(Int32)

Declaration
public ErlInputStream InputStream(int offset)
Parameters
Type Name Description
System.Int32 offset
Returns
Type Description
ErlInputStream

Poke4BE(Int32, Int32)

Write the low four bytes of a value to the stream in bif endian order, at the specified position. If the position specified is beyond the end of the stream, this method will have no effect

Declaration
public void Poke4BE(int offset, int n)
Parameters
Type Name Description
System.Int32 offset
System.Int32 n
Remarks

Normally this method should be used in conjunction with Position, when is is necessary to insert data into the stream before it is known what the actual value should be. For example:

int pos = s.Position;
s.Write4BE(0); // make space for length data,
// but final value is not yet known

[ ...more write statements...]

// later... when we know the length value
s.Poke4BE(pos, length);

Read(Byte[], Int32, Int32)

Declaration
public override int Read(byte[] buffer, int offset, int count)
Parameters
Type Name Description
System.Byte[] buffer
System.Int32 offset
System.Int32 count
Returns
Type Description
System.Int32
Overrides
System.IO.Stream.Read(System.Byte[], System.Int32, System.Int32)

Reset()

Reset the stream so that it can be reused

Declaration
public void Reset()

Seek(Int64, SeekOrigin)

Declaration
public override long Seek(long offset, SeekOrigin origin)
Parameters
Type Name Description
System.Int64 offset
System.IO.SeekOrigin origin
Returns
Type Description
System.Int64
Overrides
System.IO.Stream.Seek(System.Int64, System.IO.SeekOrigin)

SetLength(Int64)

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

ToBinary()

Declaration
public ErlBinary ToBinary()
Returns
Type Description
ErlBinary

ToBinaryString()

Convert stream content to printable binary string (i.e. <<131,10,...>>)

Declaration
public string ToBinaryString()
Returns
Type Description
System.String

Write(IErlObject)

Write an arbitrary Erlang term to the stream.

Declaration
public void Write(IErlObject o)
Parameters
Type Name Description
IErlObject o

Write(Byte)

Write one byte to the stream

Declaration
public void Write(byte b)
Parameters
Type Name Description
System.Byte b

Write(Byte[], Int32, Int32)

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

WriteAtom(ErlAtom, Encoding)

Write atom to the stream

Declaration
public void WriteAtom(ErlAtom atom, Encoding encoding = null)
Parameters
Type Name Description
ErlAtom atom
System.Text.Encoding encoding

WriteAtom(String, Encoding)

Write string value as atom to the stream

Declaration
public void WriteAtom(string atom, Encoding encoding = null)
Parameters
Type Name Description
System.String atom
System.Text.Encoding encoding

WriteBinary(ErlBinary)

Write an array of bytes to the stream as an Erlang binary

Declaration
public void WriteBinary(ErlBinary bin)
Parameters
Type Name Description
ErlBinary bin

WriteBoolean(ErlBoolean)

Write a boolean value to the stream as the Erlang atom 'true' or 'false'

Declaration
public void WriteBoolean(ErlBoolean b)
Parameters
Type Name Description
ErlBoolean b

WriteByte(ErlByte)

Write a single byte to the stream as an Erlang integer

Declaration
public void WriteByte(ErlByte b)
Parameters
Type Name Description
ErlByte b

WriteChar(Char)

Write a character to the stream as an Erlang integer

Declaration
public void WriteChar(char c)
Parameters
Type Name Description
System.Char c

WriteDouble(ErlDouble)

Write a double value to the stream

Declaration
public void WriteDouble(ErlDouble d)
Parameters
Type Name Description
ErlDouble d

WriteInt(Int32)

Write an integer to the stream

Declaration
public void WriteInt(int i)
Parameters
Type Name Description
System.Int32 i

WriteList(ErlList)

Write Erlang list to stream

Declaration
public void WriteList(ErlList list)
Parameters
Type Name Description
ErlList list

WriteListHead(Int32, Boolean)

Write an Erlang list header to the stream. After calling this method, you must write 'arity' elements to the stream followed by nil, or it will not be possible to decode it later.

Declaration
public void WriteListHead(int arity, bool isStr = false)
Parameters
Type Name Description
System.Int32 arity
System.Boolean isStr

WriteLong(ErlLong)

Write an Erlang long to the stream

Declaration
public void WriteLong(ErlLong l)
Parameters
Type Name Description
ErlLong l

WriteLong(Int64)

Write a long to stream

Declaration
public void WriteLong(long l)
Parameters
Type Name Description
System.Int64 l

WriteMap(ErlMap)

Write an Erlang map to the stream.

Declaration
public void WriteMap(ErlMap map)
Parameters
Type Name Description
ErlMap map

WriteNil()

Write an empty Erlang list to the stream

Declaration
public void WriteNil()

WritePid(ErlPid)

Write an Erlang PID to the stream

Declaration
public void WritePid(ErlPid pid)
Parameters
Type Name Description
ErlPid pid

WritePort(ErlPort)

Write an Erlang port to the stream

Declaration
public void WritePort(ErlPort p)
Parameters
Type Name Description
ErlPort p

WriteRef(ErlRef)

Write a new style (R6 and later) Erlang ref to the stream

Declaration
public void WriteRef(ErlRef r)
Parameters
Type Name Description
ErlRef r

WriteString(ErlString, Encoding)

Write a string to the stream

Declaration
public void WriteString(ErlString s, Encoding encoding = null)
Parameters
Type Name Description
ErlString s
System.Text.Encoding encoding

WriteString(String, Encoding)

Write a string to the stream

Declaration
public void WriteString(string s, Encoding encoding = null)
Parameters
Type Name Description
System.String s
System.Text.Encoding encoding

WriteTo(Stream)

Write the contents of the stream to an OutputStream

Declaration
public void WriteTo(Stream os)
Parameters
Type Name Description
System.IO.Stream os

WriteTrace(ErlTrace)

Write Erlang tuple to stream

Declaration
public void WriteTrace(ErlTrace tup)
Parameters
Type Name Description
ErlTrace tup

WriteTuple(ErlTuple)

Write Erlang tuple to stream

Declaration
public void WriteTuple(ErlTuple tup)
Parameters
Type Name Description
ErlTuple tup

WriteTupleHead(Int32)

Write an Erlang tuple header to the stream. After calling this method, you must write 'arity' elements to the stream or it will not be possible to decode it later.

Declaration
public void WriteTupleHead(int arity)
Parameters
Type Name Description
System.Int32 arity

Implements

System.IDisposable

Extension Methods

IOMiscUtils.ReadBEShort(Stream)
IOMiscUtils.ReadLEShort(Stream)
IOMiscUtils.ReadBEUShort(Stream)
IOMiscUtils.ReadLEUShort(Stream)
IOMiscUtils.ReadBEInt32(Stream)
IOMiscUtils.ReadLEInt32(Stream)
IOMiscUtils.ReadBEUInt64(Stream)
IOMiscUtils.ReadLEUInt64(Stream)
IOMiscUtils.WriteBEShort(Stream, Int16)
IOMiscUtils.WriteLEShort(Stream, Int16)
IOMiscUtils.WriteBEUShort(Stream, UInt16)
IOMiscUtils.WriteLEUShort(Stream, UInt16)
IOMiscUtils.WriteBEInt32(Stream, Int32)
IOMiscUtils.WriteLEInt32(Stream, Int32)
IOMiscUtils.WriteBEUInt64(Stream, UInt64)
IOMiscUtils.WriteLEUInt64(Stream, UInt64)
IOMiscUtils.AsCharEnumerable(Stream)
MiscUtils.NonNull<T>(T, Func<Exception>, String)
ObjectValueConversion.AsString(Object, String, ConvertErrorHandling)
ObjectValueConversion.AsNonNullOrEmptyString(Object)
ObjectValueConversion.AsLaconicConfig(Object, ConfigSectionNode, String, ConvertErrorHandling)
ObjectValueConversion.AsJSONConfig(Object, ConfigSectionNode, String, ConvertErrorHandling)
ObjectValueConversion.AsXMLConfig(Object, ConfigSectionNode, ConvertErrorHandling)
ObjectValueConversion.AsChar(Object, Char, ConvertErrorHandling)
ObjectValueConversion.AsNullableChar(Object, Nullable<Char>, ConvertErrorHandling)
ObjectValueConversion.AsByte(Object, Byte, ConvertErrorHandling)
ObjectValueConversion.AsNullableByte(Object, Nullable<Byte>, ConvertErrorHandling)
ObjectValueConversion.AsSByte(Object, SByte, ConvertErrorHandling)
ObjectValueConversion.AsNullableSByte(Object, Nullable<SByte>, ConvertErrorHandling)
ObjectValueConversion.AsShort(Object, Int16, ConvertErrorHandling)
ObjectValueConversion.AsNullableShort(Object, Nullable<Int16>, ConvertErrorHandling)
ObjectValueConversion.AsUShort(Object, UInt16, ConvertErrorHandling)
ObjectValueConversion.AsNullableUShort(Object, Nullable<UInt16>, ConvertErrorHandling)
ObjectValueConversion.AsInt(Object, Int32, ConvertErrorHandling)
ObjectValueConversion.AsNullableInt(Object, Nullable<Int32>, ConvertErrorHandling)
ObjectValueConversion.AsUInt(Object, UInt32, ConvertErrorHandling)
ObjectValueConversion.AsNullableUInt(Object, Nullable<UInt32>, ConvertErrorHandling)
ObjectValueConversion.AsLong(Object, Int64, ConvertErrorHandling)
ObjectValueConversion.AsNullableLong(Object, Nullable<Int64>, ConvertErrorHandling)
ObjectValueConversion.AsULong(Object, UInt64, ConvertErrorHandling)
ObjectValueConversion.AsNullableULong(Object, Nullable<UInt64>, ConvertErrorHandling)
ObjectValueConversion.AsDouble(Object, Double, ConvertErrorHandling)
ObjectValueConversion.AsNullableDouble(Object, Nullable<Double>, ConvertErrorHandling)
ObjectValueConversion.AsFloat(Object, Single, ConvertErrorHandling)
ObjectValueConversion.AsNullableFloat(Object, Nullable<Single>, ConvertErrorHandling)
ObjectValueConversion.AsDecimal(Object, Decimal, ConvertErrorHandling)
ObjectValueConversion.AsNullableDecimal(Object, Nullable<Decimal>, ConvertErrorHandling)
ObjectValueConversion.AsBool(Object, Boolean, ConvertErrorHandling)
ObjectValueConversion.AsNullableBool(Object, Nullable<Boolean>, ConvertErrorHandling)
ObjectValueConversion.AsGUID(Object, Guid, ConvertErrorHandling)
ObjectValueConversion.AsNullableGUID(Object, Nullable<Guid>, ConvertErrorHandling)
ObjectValueConversion.AsDateTime(Object)
ObjectValueConversion.AsDateTime(Object, DateTime, ConvertErrorHandling)
ObjectValueConversion.AsNullableDateTime(Object, Nullable<DateTime>, ConvertErrorHandling)
ObjectValueConversion.AsGDID(Object)
ObjectValueConversion.AsGDID(Object, GDID, ConvertErrorHandling)
ObjectValueConversion.AsNullableGDID(Object, Nullable<GDID>, ConvertErrorHandling)
ObjectValueConversion.AsGDIDSymbol(Object)
ObjectValueConversion.AsGDIDSymbol(Object, GDIDSymbol, ConvertErrorHandling)
ObjectValueConversion.AsNullableGDIDSymbol(Object, Nullable<GDIDSymbol>, ConvertErrorHandling)
ObjectValueConversion.AsTimeSpan(Object)
ObjectValueConversion.AsTimeSpan(Object, TimeSpan, ConvertErrorHandling)
ObjectValueConversion.AsNullableTimeSpan(Object, Nullable<TimeSpan>, ConvertErrorHandling)
ObjectValueConversion.AsEnum<TEnum>(Object, TEnum, ConvertErrorHandling)
ObjectValueConversion.AsNullableEnum<TEnum>(Object, Nullable<TEnum>, ConvertErrorHandling)
ObjectValueConversion.AsUri(Object, Uri, ConvertErrorHandling)
LEB128.WriteSLEB128(Stream, Int64, Int32)
LEB128.WriteSLEB128(Stream, Int64, out Int32, Int32)
LEB128.WriteULEB128(Stream, UInt64, UInt32)
LEB128.WriteULEB128(Stream, UInt64, out Int32, UInt32)
LEB128.ReadSLEB128(Stream)
LEB128.ReadSLEB128(Stream, out Int32)
LEB128.ReadULEB128(Stream)
LEB128.ReadULEB128(Stream, out Int32)
JSONExtensions.JSONToDynamic(Stream, Encoding, Boolean)
JSONExtensions.JSONToDataObject(Stream, Encoding, Boolean)
JSONExtensions.ToJSON(Object, JSONWritingOptions)
JSONExtensions.ToJSON(Object, TextWriter, JSONWritingOptions)
JSONExtensions.ToJSON(Object, Stream, JSONWritingOptions, Encoding)
ErlObject.ToErlObject(Object)
ErlObject.ToErlObject(Object, ErlTypeOrder, Boolean)
Back to top Copyright © 2006-2018 Agnicore Inc
Generated by DocFX