DataWriter Class |
Namespace: Tangosol.IO
public class DataWriter : BinaryWriter
The DataWriter type exposes the following members.
Name | Description | |
---|---|---|
![]() | DataWriter |
Construct a new DataWriter that will write data to the
specified Stream object.
|
Name | Description | |
---|---|---|
![]() | BaseStream | Gets the underlying stream of the BinaryWriter. (Inherited from BinaryWriter.) |
![]() | CharBuf |
Obtain a temp buffer used to avoid allocations from
repeated calls to String APIs.
|
Name | Description | |
---|---|---|
![]() | CalcUTF |
Figure out how many bytes it will take to hold the passed String.
|
![]() | Close | Closes the current BinaryWriter and the underlying stream. (Inherited from BinaryWriter.) |
![]() | Dispose | Releases all resources used by the current instance of the BinaryWriter class. (Inherited from BinaryWriter.) |
![]() | Dispose(Boolean) | Releases the unmanaged resources used by the BinaryWriter and optionally releases the managed resources. (Inherited from BinaryWriter.) |
![]() | Equals | (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | Flush | Clears all buffers for the current writer and causes any buffered data to be written to the underlying device. (Inherited from BinaryWriter.) |
![]() | FormatUTF(String) |
Format the passed String as UTF into the passed byte array.
|
![]() | FormatUTF(Byte, Int32, Char, Int32) |
Format the passed characters as UTF into the passed byte array.
|
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | Seek | Sets the position within the current stream. (Inherited from BinaryWriter.) |
![]() | Tmpbuf |
Get a buffer for formating data to bytes. Note that the resulting buffer
may be shorter than the requested size.
|
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
![]() | Write(Boolean) | Writes a one-byte Boolean value to the current stream, with 0 representing false and 1 representing true. (Inherited from BinaryWriter.) |
![]() | Write(Byte) | Writes an unsigned byte to the current stream and advances the stream position by one byte. (Inherited from BinaryWriter.) |
![]() | Write(SByte) | Writes a signed byte to the current stream and advances the stream position by one byte. (Inherited from BinaryWriter.) |
![]() | Write(Byte) | Writes a byte array to the underlying stream. (Inherited from BinaryWriter.) |
![]() | Write(Char) | Writes a Unicode character to the current stream and advances the current position of the stream in accordance with the Encoding used and the specific characters being written to the stream. (Inherited from BinaryWriter.) |
![]() | Write(Char) | Writes a character array to the current stream and advances the current position of the stream in accordance with the Encoding used and the specific characters being written to the stream. (Inherited from BinaryWriter.) |
![]() | Write(Decimal) | Writes a decimal value to the current stream and advances the stream position by sixteen bytes. (Inherited from BinaryWriter.) |
![]() | Write(Double) |
Converts a Double value to its bits and writes an Int64 instance
which stores the bits.
(Overrides BinaryWriterWrite(Double).) |
![]() | Write(Int16) |
Writes a two-byte signed integer to the current stream and
advances the stream position by two bytes.
(Overrides BinaryWriterWrite(Int16).) |
![]() | Write(Int32) |
Writes a four-byte signed integer to the current stream and
advances the stream position by four bytes.
(Overrides BinaryWriterWrite(Int32).) |
![]() | Write(Int64) |
Writes a eight-byte signed integer to the current stream and
advances the stream position by eight bytes.
(Overrides BinaryWriterWrite(Int64).) |
![]() | Write(Single) |
Converts a Single value to its bits and writes an Int32 instance
which stores the bits.
(Overrides BinaryWriterWrite(Single).) |
![]() | Write(String) |
Writes string to the stream prefixed by its length in "packed"
format.
(Overrides BinaryWriterWrite(String).) |
![]() | Write(UInt16) |
Writes a two-byte unsigned integer to the current stream and
advances the stream position by two bytes.
(Overrides BinaryWriterWrite(UInt16).) |
![]() | Write(UInt32) |
Writes a four-byte unsigned integer to the current stream and
advances the stream position by four bytes.
(Overrides BinaryWriterWrite(UInt32).) |
![]() | Write(UInt64) |
Writes a eight-byte unsigned integer to the current stream and
advances the stream position by eight bytes.
(Overrides BinaryWriterWrite(UInt64).) |
![]() | Write(Byte, Int32, Int32) | Writes a region of a byte array to the current stream. (Inherited from BinaryWriter.) |
![]() | Write(Char, Int32, Int32) | Writes a section of a character array to the current stream, and advances the current position of the stream in accordance with the Encoding used and perhaps the specific characters being written to the stream. (Inherited from BinaryWriter.) |
![]() | Write7BitEncodedInt | Writes a 32-bit integer in a compressed format. (Inherited from BinaryWriter.) |
![]() | WritePackedInt32 |
Write an Int32 value using a variable-length storage
format.
|
![]() | WritePackedInt64 |
Write an Int64 value using a variable-length storage
format.
|
![]() | WritePackedRawInt128 |
Write a RawInt128 value to DataWriter.
|
Name | Description | |
---|---|---|
![]() ![]() | CHAR_BUF_MASK |
Bitmask used against a raw offset to determine the offset within
the temporary character buffer.
|
![]() ![]() | CHAR_BUF_SIZE |
Size of the temporary character buffer. Must be a power of 2.
Size is: 256 characters (.25 KB).
|
![]() | m_achBuf |
A lazily instantiated temp buffer used to avoid allocations from
and repeated calls to String functions.
|
![]() | OutStream | Holds the underlying stream. (Inherited from BinaryWriter.) |
The "packed" format includes a sign bit (0x40) and a continuation bit (0x80) in the first byte, followed by the least 6 significant bits of the int value. Subsequent bytes (each appearing only if the previous byte had its continuation bit set) include a continuation bit (0x80) and the next least 7 significant bits of the int value.
In this way, a 32-bit value is encoded into 1-5 bytes, and 64-bit value is encoded into 1-10 bytes, depending on the magnitude of the value being encoded.