Its base object for BytesInput, FileInput, Socket input (including SSL).

All functions which read data throw Eof when the end of the stream is reached. Use pcall for capturing "Eof" error.


Properties:

bigEndian

Endianness (word byte order) used when reading numbers.
If true, big-endian is used, otherwise little-endian is used. read and write property.


Methods:

readByte()

read byte from current position


readBytes(bytes, pos, len)

Read len bytes and write them into bytes to the position specified by pos.
Returns the actual length of read data that can be smaller than len.

bytes - Bytes object

pos - write to position

len  - actual length

close()

Close the input source.
Behavior while reading after calling this method is unspecified.


readAll(bufSize)

Read and return all available data.
The bufSize argument specifies the size of chunks by which data is read.

bufSize - size of chunks

readFullBytes(bytes, pos, len)

Read len bytes and write them into bytes to the position specified by pos.
Unlike readBytes, this method tries to read the exact len amount of bytes.

bytes - Bytes object

pos - write to position

len  - actual length

read(nbytes)

Read and return nbytes bytes.

nbytes - requested size

readUntil(end)

Read a string until a character code specified by end is occurred.
The final character is not included in the resulting string.

end - character code

readLine()

Read a line of text separated by CR and/or LF bytes.
The CR/LF characters are not included in the resulting string.


readString(len)

Read and len bytes as a string.

len - requested size

readFloat()

Read a 32-bit floating point number.
Endianness is specified by the bigEndian property.


readDouble()

Read a 64-bit double-precision floating point number.
Endianness is specified by the bigEndian property.


readInt8()

Read a 8-bit signed integer.


readInt16()

Read a 16-bit signed integer.
Endianness is specified by the bigEndian property.


readUInt16()

Read a 16-bit unsigned integer.
Endianness is specified by the bigEndian property.


readInt24()

Read a 24-bit signed integer.
Endianness is specified by the bigEndian property.


readUInt24()

Read a 24-bit unsigned integer.
Endianness is specified by the bigEndian property.


readInt32()

Read a 32-bit signed integer.
Endianness is specified by the bigEndian property.



Created with the Personal Edition of HelpNDoc: Full-featured EPub generator