Library: Foundation
Package: Streams
Header: Poco/FileStream.h
Description
An input stream for reading from a file.
Files are always opened in binary mode, a text mode with CR-LF translation is not supported. Thus, the file is always opened as if the std::ios::binary flag was specified. Use an InputLineEndingConverter if you require CR-LF translation.
On Windows platforms, UTF-8 encoded Unicode paths are correctly handled.
Inheritance
Direct Base Classes: FileIOS, std::istream
All Base Classes: FileIOS, std::ios, std::istream
Member Summary
Member Functions: open
Inherited Functions: close, nativeHandle, rdbuf, size
Constructors
FileInputStream
Creates an unopened FileInputStream.
FileInputStream
FileInputStream(
const std::string & path,
std::ios::openmode mode = std::ios::in
);
Creates the FileInputStream for the file given by path, using the given mode.
The std::ios::in flag is always set, regardless of the actual value specified for mode.
Throws a FileNotFoundException (or a similar exception) if the file does not exist or is not accessible for other reasons.
Destructor
~FileInputStream
~FileInputStream();
Destroys the stream.
Member Functions
open
void open(
const std::string & path,
std::ios::openmode mode = std::ios::in
);
Opens the file specified by path, using the given mode, which will always include std::ios::in (even if not specified).
Throws a FileException (or a similar exception) if the file does not exist or is not accessible for other reasons and a new file cannot be created.