Skip to content
FutureBlitz

    Install

    Import std.io.binary

    BinaryWriter

    std.io.binary

    class

    Public Class BinaryWriter

    Writes numbers, Bools, bytes, and text to another Writer.

    Examples

    Local memory = MemoryStream()
    Local writer = BinaryWriter(memory)
    Try writer.WriteInt32(-2)
    Try writer.WriteBool(True)
    Expect(memory.ToArray() == [0xFE, 0xFF, 0xFF, 0xFF, 0x01] As UInt8[])

    std/io/binary.fb, line 138

    • Public New(inner: Writer, order: ByteOrder = ByteOrder.LITTLE) constructor #

      Writes inner, its numbers' bytes in order.

    • Public Method WriteUInt8(value: UInt8) Throws IOError method #

      Writes value, a byte.

    • Public Method WriteInt8(value: Int8) Throws IOError method #

      Writes value, a byte.

    • Public Method WriteUInt16(value: UInt16) Throws IOError method #

      Writes value, in its ByteOrder.

    • Public Method WriteInt16(value: Int16) Throws IOError method #

      Writes value, in its ByteOrder.

    • Public Method WriteUInt32(value: UInt32) Throws IOError method #

      Writes value, in its ByteOrder.

    • Public Method WriteInt32(value: Int32) Throws IOError method #

      Writes value, in its ByteOrder.

    • Public Method WriteUInt64(value: UInt64) Throws IOError method #

      Writes value, in its ByteOrder.

    • Public Method WriteInt64(value: Int64) Throws IOError method #

      Writes value, in its ByteOrder.

    • Public Method WriteFloat32(value: Float32) Throws IOError method #

      Writes value, its bits in its ByteOrder.

    • Public Method WriteFloat64(value: Float64) Throws IOError method #

      Writes value, its bits in its ByteOrder.

    • Public Method WriteBool(value: Bool) Throws IOError method #

      A byte: 1 for True, and 0 for False.

    • Public Method WriteBytes(bytes: UInt8[]) Throws IOError method #

      Writes bytes as they are.

    • Public Method WriteText(text: String) Throws IOError method #

      The text's UTF-8 bytes, without anything to say how many there are.

    Report an issue with this page or with FutureBlitz on GitHub.