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::BinaryFileReader  | 
          ( | 
          const std::string &  | 
          fileName | ) | 
           | 
        
      
 
Constructs a new BinaryFileReader by opening the given file. 
- Parameters
 - 
  
    | fileName | File to be opened.  | 
  
   
 
 
◆ ~BinaryFileReader()
      
        
          | BinaryFileReader::~BinaryFileReader  | 
          ( | 
           | ) | 
           | 
        
      
 
Destroys a BinaryFileReader, ensuring the file is correctly closed. 
If the file is already closed, does nothing. 
 
 
◆ close()
      
        
          | void BinaryFileReader::close  | 
          ( | 
           | ) | 
           | 
        
      
 
 
◆ getNextBit()
      
        
          | 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. 
 
 
 
◆ getNextByte()
      
        
          | 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. 
 
 
 
◆ hasBits()
      
        
          | 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. 
 
 
 
◆ hasBytes()
      
        
          | 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. 
 
 
 
◆ needsNextByte()
  
  
      
        
          | 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. 
 
 
 
◆ readNextByte()
  
  
      
        
          | void BinaryFileReader::readNextByte  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
private   | 
  
 
Reads in a single byte from the file. 
 
 
◆ reset()
      
        
          | void BinaryFileReader::reset  | 
          ( | 
           | ) | 
           | 
        
      
 
Resets the file pointer to the beginning of the file. 
 
 
◆ currentBit_
  
  
      
        
          | int BinaryFileReader::currentBit_ | 
         
       
   | 
  
private   | 
  
 
The current bit within the currentByte that is being read. 
 
 
◆ currentByte_
  
  
      
        
          | char BinaryFileReader::currentByte_ | 
         
       
   | 
  
private   | 
  
 
The current byte to read bits from. 
 
 
◆ file_
◆ maxBytes_
  
  
      
        
          | int BinaryFileReader::maxBytes_ | 
         
       
   | 
  
private   | 
  
 
The total number of bytes in the file. 
 
 
◆ numRead_
  
  
      
        
          | int BinaryFileReader::numRead_ | 
         
       
   | 
  
private   | 
  
 
The number of bytes read from the file. 
 
 
◆ paddingBits_
  
  
      
        
          | 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: