Class Element
A Matroska element.
Inheritance
Inherited Members
Namespace: FM.LiveSwitch.Matroska
Assembly: FM.LiveSwitch.dll
Syntax
public abstract class Element
Properties
Id
Gets the EBML ID.
Declaration
public abstract byte[] Id { get; }
Property Value
Type | Description |
---|---|
System. |
Length
Gets the total length of the element (including ID/size field), set after calling Get
Declaration
public int Length { get; }
Property Value
Type | Description |
---|---|
System. |
Size
Gets the size of the element (excluding ID/size field), set after calling Get
Declaration
public int Size { get; }
Property Value
Type | Description |
---|---|
System. |
SizeLength
Gets or sets the length of the size field, in bytes. Defaults to zero (variable size).
Declaration
public int SizeLength { get; set; }
Property Value
Type | Description |
---|---|
System. |
WriteDefaultValues
Gets or sets whether to include default values when serializing.
Declaration
public bool WriteDefaultValues { get; set; }
Property Value
Type | Description |
---|---|
System. |
Methods
Compare(Byte[], Byte[])
Compares two byte arrays for equality.
Declaration
public static bool Compare(byte[] bytes1, byte[] bytes2)
Parameters
Type | Name | Description |
---|---|---|
System. |
bytes1 | The first byte array. |
System. |
bytes2 | The second byte array. |
Returns
Type | Description |
---|---|
System. |
GetBytes()
Serializes to a byte array.
Declaration
public byte[] GetBytes()
Returns
Type | Description |
---|---|
System. |
GetInnerBytes()
Gets the inner bytes.
Declaration
protected abstract byte[] GetInnerBytes()
Returns
Type | Description |
---|---|
System. |
ReadBool(Byte[])
Reads a boolean element from the stream.
Declaration
public static bool ReadBool(byte[] value)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value. |
Returns
Type | Description |
---|---|
System. |
ReadDate(Byte[])
Reads a date string element from the stream.
Declaration
public static DateTime ReadDate(byte[] value)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value. |
Returns
Type | Description |
---|---|
System. |
ReadDouble(Byte[])
Reads a double element from the stream.
Declaration
public static double ReadDouble(byte[] value)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value. |
Returns
Type | Description |
---|---|
System. |
ReadFloat(Byte[])
Reads a float element from the stream.
Declaration
public static float ReadFloat(byte[] value)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value. |
Returns
Type | Description |
---|---|
System. |
ReadGuid(Byte[])
Reads a GUID element from the stream.
Declaration
public static Guid ReadGuid(byte[] value)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value. |
Returns
Type | Description |
---|---|
System. |
ReadId(Byte[], Int32, out Int32)
Reads a binary ID from the stream.
Declaration
public static byte[] ReadId(byte[] bytes, int offset, out int offsetPlus)
Parameters
Type | Name | Description |
---|---|---|
System. |
bytes | The byte array. |
System. |
offset | The offset into the byte array. |
System. |
offsetPlus | The offset plus the amount read. |
Returns
Type | Description |
---|---|
System. |
ReadSignedInteger(Byte[])
Reads a signed integer element from the byte array.
Declaration
public static long ReadSignedInteger(byte[] value)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value. |
Returns
Type | Description |
---|---|
System. |
ReadString(Byte[])
Reads an ASCII string element from the stream.
Declaration
public static string ReadString(byte[] value)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value. |
Returns
Type | Description |
---|---|
System. |
ReadUnsignedInteger(Byte[])
Reads an unsigned integer element from the byte array.
Declaration
public static long ReadUnsignedInteger(byte[] value)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value. |
Returns
Type | Description |
---|---|
System. |
ReadUtf8(Byte[])
Reads a UTF-8 string element from the stream.
Declaration
public static string ReadUtf8(byte[] value)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value. |
Returns
Type | Description |
---|---|
System. |
ReadValue(Byte[], Int32, out Int32)
Reads a binary value from the stream.
Declaration
public static byte[] ReadValue(byte[] bytes, int offset, out int offsetPlus)
Parameters
Type | Name | Description |
---|---|---|
System. |
bytes | The byte array. |
System. |
offset | The offset into the byte array. |
System. |
offsetPlus | The offset plus the amount read. |
Returns
Type | Description |
---|---|
System. |
ReadVariableInteger(Byte[], Int32, out Int32)
Reads a variable integer ("vint") from the byte array.
Declaration
public static long ReadVariableInteger(byte[] bytes, int offset, out int offsetPlus)
Parameters
Type | Name | Description |
---|---|---|
System. |
bytes | The byte array. |
System. |
offset | The offset into the byte array. |
System. |
offsetPlus | The offset plus the amount read. |
Returns
Type | Description |
---|---|
System. |
SerializeVariableInteger(Int64)
Serializes a variable integer.
Declaration
public static byte[] SerializeVariableInteger(long value)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value. |
Returns
Type | Description |
---|---|
System. |
SerializeVariableInteger(Int64, Int32)
Serializes a variable integer using a fixed length.
Declaration
public static byte[] SerializeVariableInteger(long value, int length)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value. |
System. |
length | The length to use. |
Returns
Type | Description |
---|---|
System. |
Write(Byte[], Byte[], ByteOutputStream)
Writes a binary element to the stream.
Declaration
protected void Write(byte[] value, byte[] id, ByteOutputStream stream)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to write. |
System. |
id | The ID of the value. |
Byte |
stream | The stream to write. |
WriteBool(Boolean, Byte[], ByteOutputStream)
Writes a boolean element to the stream.
Declaration
protected void WriteBool(bool value, byte[] id, ByteOutputStream stream)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to write. |
System. |
id | The ID of the value. |
Byte |
stream | The stream to write. |
WriteDate(DateTime, Byte[], ByteOutputStream)
Writes a date element to the stream.
Declaration
protected void WriteDate(DateTime value, byte[] id, ByteOutputStream stream)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to write. |
System. |
id | The ID of the value. |
Byte |
stream | The stream to write. |
WriteDouble(Double, Byte[], ByteOutputStream)
Writes a double element to the stream.
Declaration
protected void WriteDouble(double value, byte[] id, ByteOutputStream stream)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to write. |
System. |
id | The ID of the value. |
Byte |
stream | The stream to write. |
WriteFloat(Single, Byte[], ByteOutputStream)
Writes a float element to the stream.
Declaration
protected void WriteFloat(float value, byte[] id, ByteOutputStream stream)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to write. |
System. |
id | The ID of the value. |
Byte |
stream | The stream to write. |
WriteGuid(Guid, Byte[], ByteOutputStream)
Writes a GUID element to the stream.
Declaration
protected void WriteGuid(Guid value, byte[] id, ByteOutputStream stream)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to write. |
System. |
id | The ID of the value. |
Byte |
stream | The stream to write. |
WriteSignedInteger(Int64, Byte[], ByteOutputStream)
Writes an signed integer element to the stream.
Declaration
protected void WriteSignedInteger(long value, byte[] id, ByteOutputStream stream)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to write. |
System. |
id | The ID of the value. |
Byte |
stream | The stream to write. |
WriteString(String, Byte[], ByteOutputStream)
Writes an ASCII string element to the stream.
Declaration
protected void WriteString(string value, byte[] id, ByteOutputStream stream)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to write. |
System. |
id | The ID of the value. |
Byte |
stream | The stream to write. |
WriteUnsignedInteger(Int64, Byte[], ByteOutputStream)
Writes an unsigned integer element to the stream.
Declaration
protected void WriteUnsignedInteger(long value, byte[] id, ByteOutputStream stream)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to write. |
System. |
id | The ID of the value. |
Byte |
stream | The stream to write. |
WriteUtf8(String, Byte[], ByteOutputStream)
Writes a UTF-8 string element to the stream.
Declaration
protected void WriteUtf8(string value, byte[] id, ByteOutputStream stream)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to write. |
System. |
id | The ID of the value. |
Byte |
stream | The stream to write. |
WriteVariableInteger(Int64, ByteOutputStream)
Writes a variable integer ("vint") to the stream.
Declaration
protected void WriteVariableInteger(long value, ByteOutputStream stream)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to write. |
Byte |
stream | The stream to write. |
WriteVariableInteger(Int64, ByteOutputStream, Int32)
Writes a variable integer ("vint") to the stream using a fixed length.
Declaration
protected void WriteVariableInteger(long value, ByteOutputStream stream, int length)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to write. |
Byte |
stream | The stream to write. |
System. |
length | The length to use. |