BinaryFileReader: interface for reading binary files, bit by bit or byte by byte.  
 More...
#include <binary_file_reader.h>
BinaryFileReader: interface for reading binary files, bit by bit or byte by byte. 
Wraps an ifstream in binary mode. 
      
        
          | BinaryFileReader::BinaryFileReader | ( | const std::string & | fileName | ) |  | 
      
 
Constructs a new BinaryFileReader by opening the given file. 
- Parameters
- 
  
    | fileName | File to be opened. |  
 
 
 
      
        
          | BinaryFileReader::~BinaryFileReader | ( |  | ) |  | 
      
 
Destroys a BinaryFileReader, ensuring the file is correctly closed. 
If the file is already closed, does nothing. 
 
 
      
        
          | void BinaryFileReader::close | ( |  | ) |  | 
      
 
 
      
        
          | bool BinaryFileReader::getNextBit | ( |  | ) |  | 
      
 
Reads the next bit of the file. 
Should only be called when hasBits() is true.
- Returns
- The next bit of the file. 
 
 
      
        
          | char BinaryFileReader::getNextByte | ( |  | ) |  | 
      
 
Reads the next byte of the file. 
Should only be called when hasBytes() is true.
- Returns
- The next byte of the file, as a char. 
 
 
      
        
          | bool BinaryFileReader::hasBits | ( |  | ) | const | 
      
 
Determines if there are more bits to be read in the file. 
- Returns
- Whether or not there exists at least one more unread bit in the file. 
 
 
      
        
          | bool BinaryFileReader::hasBytes | ( |  | ) | const | 
      
 
Determines if there are more bytes to be read in the file. 
- Returns
- Whether or not there exists at least one more unread byte in the file. 
 
 
  
  | 
        
          | bool BinaryFileReader::needsNextByte | ( |  | ) | const |  | private | 
 
Determines whether or not another byte needs read from the file. 
- Returns
- Whether or not another byte must be read. 
 
 
  
  | 
        
          | void BinaryFileReader::readNextByte | ( |  | ) |  |  | private | 
 
Reads in a single byte from the file. 
 
 
      
        
          | void BinaryFileReader::reset | ( |  | ) |  | 
      
 
Resets the file pointer to the beginning of the file. 
 
 
  
  | 
        
          | int BinaryFileReader::currentBit_ |  | private | 
 
The current bit within the currentByte that is being read. 
 
 
  
  | 
        
          | char BinaryFileReader::currentByte_ |  | private | 
 
The current byte to read bits from. 
 
 
  
  | 
        
          | int BinaryFileReader::maxBytes_ |  | private | 
 
The total number of bytes in the file. 
 
 
  
  | 
        
          | int BinaryFileReader::numRead_ |  | private | 
 
The number of bytes read from the file. 
 
 
  
  | 
        
          | int BinaryFileReader::paddingBits_ |  | private | 
 
The number of padding bits there are in the final byte. 
 
 
The documentation for this class was generated from the following files: