Class EndianBinaryWriter
A BinaryWriter that switches the endian orientation of the write operations so that they are compatible across platforms.
Inheritance
Implements
Inherited Members
Namespace: Apache.NMS.Util
Assembly: Apache.NMS.dll
Syntax
[CLSCompliant(false)]
public class EndianBinaryWriter : BinaryWriter, IDisposable
Constructors
EndianBinaryWriter(Stream)
Declaration
public EndianBinaryWriter(Stream output)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | output |
Fields
MAXSTRINGLEN
Declaration
public const int MAXSTRINGLEN = 32767
Field Value
Type | Description |
---|---|
System.Int32 |
Methods
Write(Char)
Method Write
Declaration
public override void Write(char ch)
Parameters
Type | Name | Description |
---|---|---|
System.Char | ch | A char |
Overrides
Write(Char[])
Method Write
Declaration
public override void Write(char[] chars)
Parameters
Type | Name | Description |
---|---|---|
System.Char[] | chars | A char[] |
Overrides
Write(Char[], Int32, Int32)
Method Write
Declaration
public override void Write(char[] chars, int index, int count)
Parameters
Type | Name | Description |
---|---|---|
System.Char[] | chars | A char[] |
System.Int32 | index | An int |
System.Int32 | count | An int |
Overrides
Write(Double)
Method Write
Declaration
public override void Write(double value)
Parameters
Type | Name | Description |
---|---|---|
System.Double | value | A double |
Overrides
Write(Int16)
Method Write
Declaration
public override void Write(short value)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | value | A short |
Overrides
Write(Int32)
Method Write
Declaration
public override void Write(int value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | value | An int |
Overrides
Write(Int64)
Method Write
Declaration
public override void Write(long value)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | value | A long |
Overrides
Write(Single)
Method Write
Declaration
public override void Write(float value)
Parameters
Type | Name | Description |
---|---|---|
System.Single | value | A double |
Overrides
Write(String)
Method Write, writes a string to the output using the WriteString16 method.
Declaration
public override void Write(string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | A string |
Overrides
Write(UInt16)
Method Write
Declaration
public override void Write(ushort value)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | value | An ushort |
Overrides
Write(UInt32)
Method Write
Declaration
public override void Write(uint value)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | value | An uint |
Overrides
Write(UInt64)
Method Write
Declaration
public override void Write(ulong value)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | value | An ulong |
Overrides
WriteString16(String)
Method WriteString16, writes a string to the output using the Java standard modified UTF-8 encoding with an unsigned short value written first to indicate the length of the encoded data, the short is read as an unsigned value so the max amount of data this method can write is 65535 encoded bytes.
Unlike the WriteString32 method this method does not encode the length value to -1 if the string is null, this is to match the behaviour of the Java DataOuputStream class's writeUTF method.
Because modified UTF-8 encding can result in a number of bytes greater that the size of the String this method must first check that the encoding proces will not result in a value that cannot be written becuase it is greater than the max value of an unsigned short.
Declaration
public void WriteString16(string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | A string |
WriteString32(String)
Method WriteString32, writes a string to the output using the Openwire standard modified UTF-8 encoding which an int value written first to indicate the length of the encoded data, the int is read as an signed value so the max amount of data this method can write is 2^31 encoded bytes.
In the case of a null value being passed this method writes a -1 to the stream to indicate that the string is null.
Because modified UTF-8 encding can result in a number of bytes greater that the size of the String this method must first check that the encoding proces will not result in a value that cannot be written becuase it is greater than the max value of an int.
Declaration
public void WriteString32(string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | A string |