nn::fs::FileInputStream Class

Syntax

class FileInputStream : 
    private nn::fs::IInputStream,
    private nn::fs::detail::FileBase,
    private nn::util::NonCopyable< FileInputStream >

Description

Class for reading from files.

Can open the file specified by a path name and read data from it.

You can specify path names using both wide strings and multibyte strings. If you specify a multibyte string, a buffer for conversion to wide characters will be allocated on the stack. Be careful with conversions to wide characters, though, because they are not thread-safe. You should use a wide string unless you have a specific reason not to.

Limitations

When reading a file, performance will degrade enormously if the read position and buffer alignment do not match.
We recommend reading files in multiples of four bytes, and aligning your buffer on a multiple of four bytes as well.

Member Functions

FileInputStream Constructor.
Initialize Opens the specified file.
TryInitialize Tries to open the specified file.
Finalize Closes a file.
V ~FileInputStream Destructor.
V Read Loads the specified amount of data from a file into a buffer.
V TryRead Loads the specified amount of data from a file into a buffer.
V Seek Changes the access position in the file.
V TrySeek Changes the access position in the file.
V GetPosition Gets the current read position relative to the start of the file.
V TryGetPosition Gets the current read position relative to the start of the file.
V SetPosition Sets the current read position relative to the start of the file.
V TrySetPosition Sets the current read position relative to the start of the file.
V GetSize Gets the file size.
V TryGetSize Gets the file size.
SetPriority Sets a stream's access priority.
TrySetPriority Sets a stream's access priority.

Class Hierarchy

nn::fs::IPositionable
  nn::fs::IInputStream
    nn::fs::FileInputStream

Revision History

2011/11/08
Noted that conversions to wide strings are not thread-safe.
2011/10/12
Added functions for setting access priorities.
2011/03/14
Added note about limitation of read position and buffer alignment.
2010/01/29
Initial version.

CONFIDENTIAL