File input stream.
More...
#include <base/io/FileInputStream.h>
Inherits Object, and InputStream.
File input stream.
File input stream.
- Version
- 1.0
- Examples
- testsuite/digest.cpp.
◆ FileInputStream()
FileInputStream::FileInputStream |
( |
const String & |
name, |
|
|
bool |
exclusive = true |
|
) |
| |
Initializes the file input stream.
- Parameters
-
path | The path of the file. |
exclusive | Specifies that the file should be opened in exclusive mode. |
◆ available()
unsigned int FileInputStream::available |
( |
| ) |
const |
|
virtual |
Returns the number of bytes that can be read or skipped over without blocking.
- Returns
- Available number of bytes in stream.
Implements InputStream.
◆ close()
void FileInputStream::close |
( |
| ) |
|
|
virtual |
Closes the stream and releases any system resources associated with the stream.
Implements Stream.
◆ read()
unsigned int FileInputStream::read |
( |
uint8 * |
buffer, |
|
|
unsigned int |
size, |
|
|
bool |
nonblocking = false |
|
) |
| |
|
inlinevirtual |
Fills the specified buffer with bytes from the stream. In blocking mode the method does not return until all bytes have been read. In non-blocking mode the total bytes read may be any number below or equal to the requested number of bytes. Attempting to read beyond the end of a stream in blocking mode results in an EndOfFile exception.
- Parameters
-
buffer | The buffer to receive the bytes. |
size | The size of the buffer. |
nonblocking | Specifies that the method may not block. |
- Returns
- The actual number of bytes read from the stream.
Implements InputStream.
- Examples
- testsuite/digest.cpp.
◆ skip()
unsigned int FileInputStream::skip |
( |
unsigned int |
count | ) |
|
|
virtual |
Skips a specified number of bytes. Blocks if asked to skip more bytes than available.
- Parameters
-
count | The number of bytes to skip. |
- Returns
- The actual number of bytes skipped.
Implements InputStream.
◆ wait() [1/2]
void FileInputStream::wait |
( |
| ) |
const |
|
virtual |
Blocking wait for input to become available. This method does nothing for a file.
Implements InputStream.
◆ wait() [2/2]
bool FileInputStream::wait |
( |
unsigned int |
timeout | ) |
const |
|
virtual |
Blocking wait for input to become available. This method does nothing for a file.
- Parameters
-
timeout | The timeout periode in microseconds. |
- Returns
- Always returns true.
Implements InputStream.
◆ end
bool FileInputStream::end = false |
|
protected |
Specifies that the end of the file has been reached.
◆ file
File FileInputStream::file |
|
protected |
The file providing the stream.