#include <FileReader.h>
List of all members.
Public Member Functions |
| | FileReader (const FileName &, const String &path, const String &extension, bool swap) |
| virtual | ~FileReader () |
| bool | isClosed () const |
| bool | isOpen () const |
| virtual void | close () |
| virtual void | reset () |
| char | readChar () |
| int | readInt2 () |
| long | readInt4 () |
| unsigned long | readUInt4 () |
| double | readDouble () |
| float | readFloat () |
| FloatVector & | readFloats (FloatVector &v) |
| unsigned long | readSomeFloats (FloatVector &v) |
| const String & | readLine () |
| const String & | readString (unsigned long length) |
| const String & | getFullFileName () const |
| const String & | getFileName () const |
| void | open () |
| unsigned long | getFileLength () |
| void | seek (unsigned long pos) |
| void | rewind () |
| long | tell () |
| bool & | swap () |
| void | swap2Bytes (void *src, void *dest) |
| void | swap4Bytes (void *src, void *dest) |
| void | swap4Bytes (void *src) |
| void | swap8Bytes (void *src, void *dest) |
| virtual String | toString () const |
| virtual String | getClassName () const |
Static Public Member Functions |
| static FileReader & | create (const FileName &f, const String &path, const String &extension, bool swap) |
Protected Attributes |
| String | _fullFileName |
Private Member Functions |
| void | read (void *buffer, unsigned long length) |
| | FileReader (const FileReader &) |
| const FileReader & | operator= (const FileReader &) |
| bool | operator== (const FileReader &) const |
| bool | operator!= (const FileReader &) const |
Private Attributes |
| FILE * | _pFileStruct |
| FileName | _fileName |
| String | _path |
| String | _extension |
| unsigned long | _fileLength |
| bool | _fileLengthDefined |
| String | _string |
| bool | _swap |
Friends |
| class | TestFeatureFileReaderRaw |
| class | TestFeatureFileReaderHTK |
| class | TestFeatureFileReaderSPro4 |
| class | TestFeatureFileReader |
| class | TestMixtureFileReaderRaw |
| class | TestMixtureFileReaderAmiral |
Detailed Description
Convenient class used to read a file. DO NOT USE ***
- Author:
- Frederic Wils frederic.wils@lia.univ-avignon.fr
- Version:
- 1.0
- Date:
- 2003
Definition at line 84 of file FileReader.h.
Constructor & Destructor Documentation
| alize::FileReader::FileReader |
( |
const FileName & |
, |
|
|
const String & |
path, |
|
|
const String & |
extension, |
|
|
bool |
swap |
|
) |
| [explicit] |
| virtual alize::FileReader::~FileReader |
( |
) |
[virtual] |
Close the opened file (if it is).
| alize::FileReader::FileReader |
( |
const FileReader & |
) |
[private] |
Member Function Documentation
| virtual void alize::FileReader::close |
( |
) |
[virtual] |
| virtual String alize::FileReader::getClassName |
( |
) |
const [virtual] |
Returns the name of the class
- Returns:
- the name of the class of the object as a String
Implements alize::Object.
| unsigned long alize::FileReader::getFileLength |
( |
) |
|
Reads and returns the file length
- Exceptions:
-
- Returns:
- the length of the file in bytes
| const String& alize::FileReader::getFileName |
( |
) |
const |
Returns the name of the file.
- Returns:
- the name of the file.
| const String& alize::FileReader::getFullFileName |
( |
) |
const |
| bool alize::FileReader::isClosed |
( |
) |
const |
Tests whether the file is closed
- Returns:
- true if the file is closed; false otherwise
| bool alize::FileReader::isOpen |
( |
) |
const |
Tests whether the file is opened
- Returns:
- true if the file is opened; false otherwise
| void alize::FileReader::open |
( |
) |
|
Opens the file. If it is already opened, closes it beforehand.
- Exceptions:
-
| bool alize::FileReader::operator!= |
( |
const FileReader & |
) |
const [private] |
| bool alize::FileReader::operator== |
( |
const FileReader & |
) |
const [private] |
| void alize::FileReader::read |
( |
void * |
buffer, |
|
|
unsigned long |
length |
|
) |
| [private] |
flag for numeric data Low-level method to read bytes from a file.
- Parameters:
-
| buffer | A pointer to a memory area to store the data number of bytes to read |
- Exceptions:
-
| char alize::FileReader::readChar |
( |
) |
|
Reads an input byte
- Returns:
- the char value
- Exceptions:
-
| double alize::FileReader::readDouble |
( |
) |
|
Reads eight input bytes
- Returns:
- the double value
- Exceptions:
-
| float alize::FileReader::readFloat |
( |
) |
|
Reads four input bytes
- Returns:
- the float value
- Exceptions:
-
Reads a set of float value (4 bytes)
- Parameters:
-
- Exceptions:
-
| int alize::FileReader::readInt2 |
( |
) |
|
Reads two input bytes
- Returns:
- the value in a integer variable
- Exceptions:
-
| long alize::FileReader::readInt4 |
( |
) |
|
Reads FOUR input bytes
- Returns:
- the value in a long variable
- Exceptions:
-
| const String& alize::FileReader::readLine |
( |
) |
|
Reads the next line of text from the input stream. It reads successive bytes until it encounters a line terminator or end of file. The characters read are then returned as a String. If end of file is encountered then a EOFException is thrown. If the character '
' is encountered, it is discarded and reading ceases. If the character '' is encountered, it is discarded and, if the following byte converts to the character '
', then that is discarded also; reading then ceases. If end of file is encountered before either of the characters '
' and '' is encountered, reading ceases. Once reading has ceased, a String is returned that contains all the characters read and not discarded, taken in order.
- Returns:
- the next line of text from the input stream
- Exceptions:
-
Referenced by alize::ConfigFileReaderRaw::readConfig(), and alize::XListFileReader::readList().
| unsigned long alize::FileReader::readSomeFloats |
( |
FloatVector & |
v ) |
|
Tries to read a set of float value (4 bytes). The number is determined by the smaller between vector size and the number of available float values in the stream before the end of its buffer
- Parameters:
-
- Returns:
- the number of float values read
- Exceptions:
-
| const String& alize::FileReader::readString |
( |
unsigned long |
length ) |
|
Reads a sequence of 'length' characters.
- Parameters:
-
| length | number of characters to read |
- Returns:
- a constant reference to a string of the characters read
- Exceptions:
-
Referenced by alize::ConfigFileReaderXml::readOneChar().
| unsigned long alize::FileReader::readUInt4 |
( |
) |
|
Reads four input bytes
- Returns:
- the value in an unsigned long variable
- Exceptions:
-
| virtual void alize::FileReader::reset |
( |
) |
[virtual] |
Repositions the file position indicator to the beginning of the file (if it is opened). Does nothing if the file is closed.
- Exceptions:
-
| void alize::FileReader::rewind |
( |
) |
|
| void alize::FileReader::seek |
( |
unsigned long |
pos ) |
|
| bool& alize::FileReader::swap |
( |
) |
|
| void alize::FileReader::swap2Bytes |
( |
void * |
src, |
|
|
void * |
dest |
|
) |
| |
| void alize::FileReader::swap4Bytes |
( |
void * |
src, |
|
|
void * |
dest |
|
) |
| |
| void alize::FileReader::swap4Bytes |
( |
void * |
src ) |
|
| void alize::FileReader::swap8Bytes |
( |
void * |
src, |
|
|
void * |
dest |
|
) |
| |
| long alize::FileReader::tell |
( |
) |
|
| virtual String alize::FileReader::toString |
( |
) |
const [virtual] |
This method is frequently overridden in the derived classes. If it is not, it returns the name of the class of the object and the address of the object
- Returns:
- a description of the object
Reimplemented from alize::Object.
Friends And Related Function Documentation
friend class TestFeatureFileReader [friend] |
friend class TestFeatureFileReaderHTK [friend] |
friend class TestFeatureFileReaderRaw [friend] |
friend class TestFeatureFileReaderSPro4 [friend] |
friend class TestMixtureFileReaderAmiral [friend] |
friend class TestMixtureFileReaderRaw [friend] |
Member Data Documentation
current file descriptor. Can be NULL
Definition at line 259 of file FileReader.h.
The documentation for this class was generated from the following file: