Click or drag to resize

DataWriter Class

.NET API Reference for Oracle® Coherence Community Edition
(14.1.1.0)
E55634-01
BinaryWriter extension that adds methods for writing 32 and 64-bit integer values in a packed format.
Inheritance Hierarchy

Namespace:  Tangosol.IO
Assembly:  Coherence (in Coherence.dll) Version: 14.1.1.1 (14.1.1.1)
Syntax
C#
public class DataWriter : BinaryWriter

The DataWriter type exposes the following members.

Constructors
  NameDescription
Public methodDataWriter
Construct a new DataWriter that will write data to the specified Stream object.
Top
Properties
  NameDescription
Public propertyBaseStream
Gets the underlying stream of the BinaryWriter.
(Inherited from BinaryWriter.)
Protected propertyCharBuf
Obtain a temp buffer used to avoid allocations from repeated calls to String APIs.
Top
Methods
  NameDescription
Protected methodCalcUTF
Figure out how many bytes it will take to hold the passed String.
Public methodClose
Closes the current BinaryWriter and the underlying stream.
(Inherited from BinaryWriter.)
Public methodDispose
Releases all resources used by the current instance of the BinaryWriter class.
(Inherited from BinaryWriter.)
Protected methodDispose(Boolean)
Releases the unmanaged resources used by the BinaryWriter and optionally releases the managed resources.
(Inherited from BinaryWriter.)
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodFlush
Clears all buffers for the current writer and causes any buffered data to be written to the underlying device.
(Inherited from BinaryWriter.)
Public methodFormatUTF(String)
Format the passed String as UTF into the passed byte array.
Protected methodFormatUTF(Byte, Int32, Char, Int32)
Format the passed characters as UTF into the passed byte array.
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodSeek
Sets the position within the current stream.
(Inherited from BinaryWriter.)
Protected methodTmpbuf
Get a buffer for formating data to bytes. Note that the resulting buffer may be shorter than the requested size.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodWrite(Boolean)
Writes a one-byte Boolean value to the current stream, with 0 representing false and 1 representing true.
(Inherited from BinaryWriter.)
Public methodWrite(Byte)
Writes an unsigned byte to the current stream and advances the stream position by one byte.
(Inherited from BinaryWriter.)
Public methodWrite(SByte)
Writes a signed byte to the current stream and advances the stream position by one byte.
(Inherited from BinaryWriter.)
Public methodWrite(Byte)
Writes a byte array to the underlying stream.
(Inherited from BinaryWriter.)
Public methodWrite(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.)
Public methodWrite(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.)
Public methodWrite(Decimal)
Writes a decimal value to the current stream and advances the stream position by sixteen bytes.
(Inherited from BinaryWriter.)
Public methodWrite(Double)
Converts a Double value to its bits and writes an Int64 instance which stores the bits.
(Overrides BinaryWriterWrite(Double).)
Public methodWrite(Int16)
Writes a two-byte signed integer to the current stream and advances the stream position by two bytes.
(Overrides BinaryWriterWrite(Int16).)
Public methodWrite(Int32)
Writes a four-byte signed integer to the current stream and advances the stream position by four bytes.
(Overrides BinaryWriterWrite(Int32).)
Public methodWrite(Int64)
Writes a eight-byte signed integer to the current stream and advances the stream position by eight bytes.
(Overrides BinaryWriterWrite(Int64).)
Public methodWrite(Single)
Converts a Single value to its bits and writes an Int32 instance which stores the bits.
(Overrides BinaryWriterWrite(Single).)
Public methodWrite(String)
Writes string to the stream prefixed by its length in "packed" format.
(Overrides BinaryWriterWrite(String).)
Public methodWrite(UInt16)
Writes a two-byte unsigned integer to the current stream and advances the stream position by two bytes.
(Overrides BinaryWriterWrite(UInt16).)
Public methodWrite(UInt32)
Writes a four-byte unsigned integer to the current stream and advances the stream position by four bytes.
(Overrides BinaryWriterWrite(UInt32).)
Public methodWrite(UInt64)
Writes a eight-byte unsigned integer to the current stream and advances the stream position by eight bytes.
(Overrides BinaryWriterWrite(UInt64).)
Public methodWrite(Byte, Int32, Int32)
Writes a region of a byte array to the current stream.
(Inherited from BinaryWriter.)
Public methodWrite(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.)
Protected methodWrite7BitEncodedInt
Writes a 32-bit integer in a compressed format.
(Inherited from BinaryWriter.)
Public methodWritePackedInt32
Write an Int32 value using a variable-length storage format.
Public methodWritePackedInt64
Write an Int64 value using a variable-length storage format.
Public methodWritePackedRawInt128
Write a RawInt128 value to DataWriter.
Top
Fields
  NameDescription
Protected fieldStatic memberCHAR_BUF_MASK
Bitmask used against a raw offset to determine the offset within the temporary character buffer.
Protected fieldStatic memberCHAR_BUF_SIZE
Size of the temporary character buffer. Must be a power of 2. Size is: 256 characters (.25 KB).
Protected fieldm_achBuf
A lazily instantiated temp buffer used to avoid allocations from and repeated calls to String functions.
Protected fieldOutStream
Holds the underlying stream.
(Inherited from BinaryWriter.)
Top
Remarks

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.

See Also