Creates a new data reader for reading data from the given source.
The source to read from.
Returns the default endianness of the reader.
the default endianness used when no endianness is specified as parameter to the various read methods.
Executes the given operation as a look-ahead operation. So any reading from the reader is a look-ahead and the stream position will be reset when operation is finished. Look-ahead operations can be nested.
Note that while reading data in a look-ahead operation buffers read from the stream pile up in memory because it is not possible to seek in a stream. So the only way to rewind to the previous position in the stream is to remember all the buffers read since then. So keep look-ahead operations short so in the best case the operation takes place in the same or the next buffer.
The look-ahead operation to perform.
Reads a signed 64 bit value.
Optional endianness. Defaults to endianness the reader was configured with.
Reads an array of signed 64 bit values.
The buffer to write the read bytes to.
Optional
options: ReadMultiByteArrayOptionsOptional read array option.
the number of read 16 bit values. 0 when end of stream is reached or 0 bytes were requested to read.
Reads a unsigned 64 bit value.
Optional endianness. Defaults to endianness the reader was configured with.
Reads an array of unsigned 64 bit values.
The buffer to write the read bytes to.
Optional read array option.
the number of read 16 bit values. 0 when end of stream is reached or 0 bytes were requested to read.
Reads the given number of bits and returns them as a number array.
TODO This can be optimized by reading the bits directly from the buffer instead of asynchronously reading bit by bit.
The number of bits to read.
The read bits. Empty array when end of stream has been reached without reading any bit.
Reads a signed 16 bit value.
Optional endianness. Defaults to endianness the reader was configured with.
Reads an array of signed 16 bit values.
The buffer to write the read bytes to.
Optional
options: ReadMultiByteArrayOptionsOptional read array option.
the number of read 16 bit values. 0 when end of stream is reached or 0 bytes were requested to read.
Reads a signed 32 bit value.
Optional endianness. Defaults to endianness the reader was configured with.
Reads an array of signed 32 bit values.
The buffer to write the read bytes to.
Optional
options: ReadMultiByteArrayOptionsOptional read array option.
the number of read 16 bit values. 0 when end of stream is reached or 0 bytes were requested to read.
Reads an array of signed 8 bit values.
The buffer to write the read bytes to.
Offset within the buffer to start writing to. Defaults to 0.
Number of bytes to read. Defaults to buffer size minus offset.
the number of read bytes. 0 when end of stream is reached or 0 bytes were requested to read.
Reads a line from the stream. EOL marker can be defined in the options and by default stops at CRLF or LF without including the EOL marker in the returned string.
the read line. Null when end of stream is reached.
Reads a null-terminated string from the stream.
the read line. Null when end of stream is reached.
Reads a string from the stream.
The maximum number of bytes to read. Only in ASCII encoding this is the same as the length of the string. In other encodings the returned string may be shorter.
The encoding. Defaults to encoding the reader was configured with.
the read string. May be smaller than requested size. Empty when end of stream is reached.
Reads an unsigned 16 bit value.
Optional endianness. Defaults to endianness the reader was configured with.
Reads an array of unsigned 16 bit values.
The buffer to write the read bytes to.
Optional read array option.
the number of read 16 bit values. 0 when end of stream is reached or 0 bytes were requested to read.
Reads an unsigned 32 bit value.
Optional endianness. Defaults to endianness the reader was configured with.
Reads an array of unsigned 32 bit values.
The buffer to write the read bytes to.
Optional read array option.
the number of read 16 bit values. 0 when end of stream is reached or 0 bytes were requested to read.
Reads an array of unsigned 8 bit values.
The buffer to write the read bytes to.
Offset within the buffer to start writing to. Defaults to 0.
Number of bytes to read. Defaults to buffer size minus offset.
the number of read bytes. 0 when end of stream is reached or 0 bytes were requested to read.
Skips the given number of bits. This is not the same as simply reading the given number of bits and ignoring the read data. Instead it is optimized to first skip as many bits as needed to get to a byte boundary then skipping full bytes inside current buffer, optionally fetching new buffers and finally skipping the remaining number of bits.
The number of bits to skip.
The actual number of skipped bits. Will be lower than given number if end of stream has been reached.
Skips the given number of bytes. This is not the same as simply reading the given number of bytes and ignoring the read data. Instead it is optimized to first skip as many bits as needed to get to a byte boundary then skipping full bytes inside the current buffer, optionally fetching new buffers and finally skipping the remaining bits.
Actually this is the same as calling skipBits with the number of bytes converted to the number of bits.
The number of bytes to skip.
The actual number of fully skipped bytes (not counting partially skipped bytes). Will be lower than given number if end of stream has been reached.
Reads all kind of data values from the specified source.