DataOutputSink class

An adapter over a Sink<List<int>> for writing to a stream. This class presents an API based on Java's java.io.DataOutputStream.

DataOutputSink does no buffering.

Constructors

DataOutputSink(Sink<List<int>> _dest, [Endian endian = Endian.big])
Create a sink that sends its data to dest with the given initial endian setting. Choose Endian.big for interoperability with java.io.DataOutputStream.

Properties

endian Endian
The current endian setting, either Endian.big or Endian.little. This is used for converting numeric types. Choose Endian.big for interoperability with java.io.DataOutputStream.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

close() → void
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
writeBoolean(bool v) → void
Writes a byte containg 0 if v is false, and 1 if it is true.
writeByte(int b) → void
Write the low 8 bits of the given integer as a single byte.
writeBytes(List<int> bytes) → void
Write the given bytes. A Uint8List is the recommended subtype of List<int>.
writeDouble(double v) → void
Writes an eight-byte double using the current endian format.
writeFloat(double v) → void
Writes a four-byte float using the current endian format.
writeInt(int v) → void
Writes a 4 byte int using the current endian format.
writeLong(int v) → void
Writes an 8 byte long int using the current endian format.
writeShort(int v) → void
Writes a 2 byte signed short using the current endian format.
writeUnsignedInt(int v) → void
Writes a 4 byte unsigned int using the current endian format.
writeUnsignedLong(int v) → void
Writes an unsigned 8 byte long using the current endian format. Converts a Dart int according to the semantics of [ByteData.setUint64`.
writeUnsignedShort(int v) → void
Writes a 2 byte unsigned short using the current endian format.
writeUTF8(String s) → void
Write the given string as an unsigned short giving the byte length, followed by that many bytes containing the UTF8 encoding. The short is written using the current endian format. This should be compatible with Java's DataOutputStream.writeUTF8(), as long as the string contains no nulls and no UTF formats beyond the 1, 2 and 3 byte formats. See https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/DataInput.html#modified-utf-8

Operators

operator ==(Object other) bool
The equality operator.
inherited