tesseract  3.05.02
tesseract::InputFileBuffer Class Reference

#include <input_file_buffer.h>

Public Member Functions

 InputFileBuffer (const string &file_name)
 
virtual ~InputFileBuffer ()
 
int Read (void *buffer, int bytes_to_read)
 

Protected Attributes

string file_name_
 
FILE * fp_
 

Detailed Description

Definition at line 28 of file input_file_buffer.h.

Constructor & Destructor Documentation

◆ InputFileBuffer()

tesseract::InputFileBuffer::InputFileBuffer ( const string &  file_name)
explicit

Definition at line 22 of file input_file_buffer.cpp.

23  : file_name_(file_name) {
24  fp_ = NULL;
25 }

◆ ~InputFileBuffer()

tesseract::InputFileBuffer::~InputFileBuffer ( )
virtual

Definition at line 28 of file input_file_buffer.cpp.

28  {
29  if (fp_ != NULL) {
30  fclose(fp_);
31  }
32 }

Member Function Documentation

◆ Read()

int tesseract::InputFileBuffer::Read ( void *  buffer,
int  bytes_to_read 
)

Definition at line 35 of file input_file_buffer.cpp.

35  {
36  // open the file if necessary
37  if (fp_ == NULL) {
38  fp_ = fopen(file_name_.c_str(), "rb");
39  if (fp_ == NULL) {
40  return 0;
41  }
42  }
43  return fread(buffer, 1, bytes_to_read, fp_);
44 }

Member Data Documentation

◆ file_name_

string tesseract::InputFileBuffer::file_name_
protected

Definition at line 35 of file input_file_buffer.h.

◆ fp_

FILE* tesseract::InputFileBuffer::fp_
protected

Definition at line 36 of file input_file_buffer.h.


The documentation for this class was generated from the following files: