Input
An Input is an abstract reader. See other classes in the haxe.io
package
for several possible implementations.
All functions which read data throw Eof
when the end of the stream
is reached.
Instance Members
bigEndian: Bool
Endianness (word byte order) used when reading numbers.
If true
, big-endian is used, otherwise little-endian
is used.
readByte(): Int
Read and return one byte.
Returns |
---|
Int |
Read len
bytes and write them into s
to the position specified by pos
.
Returns the actual length of read data that can be smaller than len
.
See readFullBytes
that tries to read the exact amount of specified bytes.
Name | Type |
---|---|
s |
Bytes |
pos |
Int |
len |
Int |
Returns |
---|
Int |
close(): Void
Close the input source.
Behaviour while reading after calling this method is unspecified.
Read and return all available data.
The bufsize
optional argument specifies the size of chunks by
which data is read. Its default value is target-specific.
Name | Type | Default |
---|---|---|
bufsize |
Int | (optional) |
Returns |
---|
Bytes |
Read len
bytes and write them into s
to the position specified by pos
.
Unlike readBytes
, this method tries to read the exact len
amount of bytes.
Name | Type |
---|---|
s |
Bytes |
pos |
Int |
len |
Int |
Read and return nbytes
bytes.
Name | Type |
---|---|
nbytes |
Int |
Returns |
---|
Bytes |
Read a string until a character code specified by end
is occurred.
The final character is not included in the resulting string.
Name | Type |
---|---|
end |
Int |
Returns |
---|
String |
readFloat(): Float
Read a 32-bit floating point number.
Endianness is specified by the bigEndian
property.
Returns |
---|
Float |
readInt16(): Int
Read a 16-bit signed integer.
Endianness is specified by the bigEndian
property.
Returns |
---|
Int |
readUInt16(): Int
Read a 16-bit unsigned integer.
Endianness is specified by the bigEndian
property.
Returns |
---|
Int |
readInt24(): Int
Read a 24-bit signed integer.
Endianness is specified by the bigEndian
property.
Returns |
---|
Int |
readInt32(): Int
Read a 32-bit signed integer.
Endianness is specified by the bigEndian
property.
Returns |
---|
Int |
Read and len
bytes as a string.
Name | Type | Default |
---|---|---|
len |
Int | |
encoding |
Anonymous | (optional) |
Returns |
---|
String |