Streams are used to read or write data in a sequential manner. More...
Extended by: | |
Properties: | |
Methods: |
|
The low level Read and Write methods can be used to transfer data directly to/from databuffer objects. These methods return the number of bytes actually transferred, which may be less than requested if an IO error occurs or end-of-file is reached.
The higher level read and write methods will throw a StreamReadError or StreamWriteError exception if an IO error occurs or end-file-file is reached during processing.
The Eof method can be used detect end-of-file status when reading a stream. If this method returns a non-0 value, there is no data left to be read.
Some types of streams are also seekable, meaning they support an internal 'position' variable that controls where data is read/written and may be manually modified.
Closes the stream and released any OS resources in use.
This method should always be used when you are finished with a stream.
Reads count bytes from the stream into databuffer, starting at address offset within the databuffer.
Returns the number of bytes actually read. This may be less than count if an IO error occurs or end-of-file has been reached.
If count is non-zero, this method will block until either at least 1 byte is available to be read, an IO error occurs or end-of-file has been reached.
Reads count bytes from the stream into databuffer, starting at address offset within the databuffer.
If count is non-zero, this method will block until all bytes have been read.
A StreamReadError is thrown if not all bytes could be read.
Reads an 8 bit byte from the stream.
A StreamReadError will be thrown if a value could not be read.
Reads a 32 bit float value from the stream.
A StreamReadError will be thrown if a value could not be read.
Reads a 32 bit int value from the stream.
A StreamReadError will be thrown if a value could not be read.
Reads a 16 bit int value from the stream.
A StreamReadError will be thrown if a value could not be read.
Reads count bytes from the stream and converts them to a string using the given encoding.
encoding should be utf8
or ascii
.
Reads all bytes from the stream until end-of-file and converts them to a string using the given encoding.
encoding should be utf8
or ascii
.
If the stream is seekable, adjusts the read/write position within the stream and returns the new read/write position.
Writes count bytes from databuffer to the stream, starting at address offset within the databuffer.
Returns the number of bytes actually written. This will be the same as count unless an IO error has occured.
This method may block if the underlying stream is full.
Writes count bytes from databuffer to the stream, starting at address offset within the databuffer.
A StreamWriteError is thrown if not all bytes could be written.
Writes an 8 bit byte to the stream.
A StreamWriteError will be thrown if value could not be written.
Writes a 32 bit float value to the stream.
A StreamWriteError will be thrown if value could not be written.
Writes a 32 bit int value to the stream.
A StreamWriteError will be thrown if value could not be written.
Write a 16 bit int value to the stream.
A StreamWriteError will be thrown if value could not be written.