Main Page | Class Hierarchy | Compound List | File List | Compound Members | File Members

BinaryIO Class Reference

provides methods for file i/o as needed by the rest of steghide

#include <BinaryIO.h>

List of all members.

Public Types

enum  MODE { READ, WRITE }

Public Member Functions

 BinaryIO (void)
 BinaryIO (const std::string &fn, MODE m)
 ~BinaryIO (void)
const std::string & getName (void) const
bool is_open (void) const
bool is_std (void) const
unsigned long getPos (void) const
bool eof (void) const
void open (const std::string &fn, MODE m)
void close (void)
BYTE read8 (void)
UWORD16 read16_le (void)
UWORD16 read16_be (void)
UWORD32 read32_le (void)
UWORD32 read32_be (void)
UWORD32 read_le (unsigned short n)
std::string readstring (unsigned int len)
void write8 (BYTE val)
void write16_le (UWORD16 val)
void write16_be (UWORD16 val)
void write32_le (UWORD32 val)
void write32_be (UWORD32 val)
void write_le (UWORD32 val, unsigned short n)
void writestring (const std::string &s)
FILE * getStream (void) const

Protected Member Functions

void setStream (FILE *s)
void setName (const std::string &fn)
MODE getMode (void) const
void setMode (MODE m)

Private Member Functions

void init (void)
void set_open (bool o)
void checkForce (const std::string &fn) const
bool Fileexists (const std::string &fn) const

Private Attributes

std::string Name
FILE * Stream
bool FileOpen
MODE Mode


Member Enumeration Documentation

enum BinaryIO::MODE
 

Enumeration values:
READ 
WRITE 


Constructor & Destructor Documentation

BinaryIO::BinaryIO void   ) 
 

BinaryIO::BinaryIO const std::string &  fn,
MODE  m
 

construct a BinaryIO object

Parameters:
fn the filename ("" to indicate stdin/stdout)
m the mode (BinaryIO::READ or BinaryIO::WRITE)
The file described by fn is opened in the given mode.

BinaryIO::~BinaryIO void   ) 
 


Member Function Documentation

void BinaryIO::checkForce const std::string &  fn  )  const [private]
 

when opening a file in write mode perform various checks depending on the value of the force argument

void BinaryIO::close void   ) 
 

close the currently open file - it is save to call close() even if is_std() is true

bool BinaryIO::eof void   )  const
 

is the current state of this file at the end of the file

bool BinaryIO::Fileexists const std::string &  fn  )  const [private]
 

check if the file described by fn exists

Returns:
true iff a fopen call with fn as file name succeeded

MODE BinaryIO::getMode void   )  const [inline, protected]
 

const std::string& BinaryIO::getName void   )  const [inline]
 

get the name (with path) of this file

unsigned long BinaryIO::getPos void   )  const [inline]
 

get the current position in the current file

FILE* BinaryIO::getStream void   )  const [inline]
 

get the underlying cstdio FILE* pointer

void BinaryIO::init void   )  [private]
 

bool BinaryIO::is_open void   )  const [inline]
 

is this file currently opened ?

bool BinaryIO::is_std void   )  const [inline]
 

is this file a standard stream (stdin or stdout) ?

void BinaryIO::open const std::string &  fn,
MODE  m
 

open the file given by fn in the mode m

Parameters:
fn a filename ("" to indicate stdin/stdout)
m the mode (BinaryIO::READ or BinaryIO::WRITE)

UWORD16 BinaryIO::read16_be void   ) 
 

read two bytes from the file using big-endian byte ordering

UWORD16 BinaryIO::read16_le void   ) 
 

read two bytes from the file using little-endian byte ordering

UWORD32 BinaryIO::read32_be void   ) 
 

read four bytes from the file using big-endian byte ordering

UWORD32 BinaryIO::read32_le void   ) 
 

read four bytes from the file using little-endian byte ordering

BYTE BinaryIO::read8 void   ) 
 

read one byte from the file

UWORD32 BinaryIO::read_le unsigned short  n  ) 
 

read n bytes (little endian byte ordering)

Parameters:
n the number of bytes to read (must be <= 4)

std::string BinaryIO::readstring unsigned int  len  ) 
 

read a string with length len from the file

void BinaryIO::set_open bool  o  )  [inline, private]
 

void BinaryIO::setMode MODE  m  )  [inline, protected]
 

void BinaryIO::setName const std::string &  fn  )  [inline, protected]
 

void BinaryIO::setStream FILE *  s  )  [inline, protected]
 

void BinaryIO::write16_be UWORD16  val  ) 
 

write two bytes to the file using big-endian byte ordering

void BinaryIO::write16_le UWORD16  val  ) 
 

write two bytes to the file using little-endian byte ordering

void BinaryIO::write32_be UWORD32  val  ) 
 

write four bytes to the file using big-endian byte ordering

void BinaryIO::write32_le UWORD32  val  ) 
 

write four bytes to the file using little-endian byte ordering

void BinaryIO::write8 BYTE  val  ) 
 

write one byte to the file

void BinaryIO::write_le UWORD32  val,
unsigned short  n
 

write n bytes of val (little endian byte ordering)

Parameters:
n the number of bytes to write (must be <= 4)
val the value

void BinaryIO::writestring const std::string &  s  ) 
 


Member Data Documentation

bool BinaryIO::FileOpen [private]
 

MODE BinaryIO::Mode [private]
 

std::string BinaryIO::Name [private]
 

FILE* BinaryIO::Stream [private]
 


The documentation for this class was generated from the following files:
Generated on Thu Nov 13 23:44:22 2003 for steghide by doxygen 1.3.3