Output
An Output is an abstract write. A specific output implementation will only
have to override the writeByte
and maybe the write
, flush
and close
methods. See File.write
and String.write
for two ways of creating an
Output.
Instance Members
bigEndian: Bool
Endianness (word byte order) used when writing numbers.
If true
, big-endian is used, otherwise little-endian
is used.
Write one byte.
Name | Type |
---|---|
c |
Int |
Write len
bytes from s
starting by position specified by pos
.
Returns the actual length of written data that can differ from len
.
See writeFullBytes
that tries to write the exact amount of specified bytes.
Name | Type |
---|---|
s |
Bytes |
pos |
Int |
len |
Int |
Returns |
---|
Int |
flush(): Void
Flush any buffered data.
close(): Void
Close the output.
Behaviour while writing after calling this method is unspecified.
Write all bytes stored in s
.
Name | Type |
---|---|
s |
Bytes |
Write len
bytes from s
starting by position specified by pos
.
Unlike writeBytes
, this method tries to write the exact len
amount of bytes.
Name | Type |
---|---|
s |
Bytes |
pos |
Int |
len |
Int |
Write x
as 32-bit floating point number.
Endianness is specified by the bigEndian
property.
Name | Type |
---|---|
x |
Float |
Write x
as 16-bit signed integer.
Endianness is specified by the bigEndian
property.
Name | Type |
---|---|
x |
Int |
Write x
as 16-bit unsigned integer.
Endianness is specified by the bigEndian
property.
Name | Type |
---|---|
x |
Int |
Write x
as 24-bit signed integer.
Endianness is specified by the bigEndian
property.
Name | Type |
---|---|
x |
Int |
Write x
as 24-bit unsigned integer.
Endianness is specified by the bigEndian
property.
Name | Type |
---|---|
x |
Int |
Write x
as 32-bit signed integer.
Endianness is specified by the bigEndian
property.
Name | Type |
---|---|
x |
Int |
Read all available data from i
and write it.
The bufsize
optional argument specifies the size of chunks by
which data is read and written. Its default value is 4096.
Name | Type | Default |
---|---|---|
i |
Input | |
bufsize |
Int | (optional) |
Write s
string.
Name | Type | Default |
---|---|---|
s |
String | |
encoding |
Anonymous | (optional) |