JX Application Framework
Loading...
Searching...
No Matches
Functions
jFStreamUtil.cpp File Reference
#include "jFStreamUtil.h"
#include "jStreamUtil.h"
#include "jFileUtil.h"
#include "JString.h"
#include <stdio.h>
#include "jAssert.h"
Include dependency graph for jFStreamUtil.cpp:

Functions

void JReadFile (const JString &fileName, JString *str)
 
void JReadFile (std::ifstream &input, JString *str)
 
void JReadFile (std::fstream &input, JString *str)
 
JSize JGetFStreamLength (std::ifstream &theStream)
 
JSize JGetFStreamLength (std::fstream &theStream)
 
bool JConvertToStream (const int input, std::ifstream *input2, JString *tempFullName, const bool closeInput)
 

Function Documentation

◆ JConvertToStream()

bool JConvertToStream ( const int  input,
std::ifstream *  input2,
JString tempFullName,
const bool  closeInput 
)

Convert the data from the given file descriptor into an std::ifstream. The location of the file is returned in tempFullName.

This would be unnecessary if libstdc++ provided a stream wrapper for arbitrary file descriptors.

◆ JGetFStreamLength() [1/2]

JSize JGetFStreamLength ( std::fstream &  theStream)

◆ JGetFStreamLength() [2/2]

JSize JGetFStreamLength ( std::ifstream &  theStream)

Returns the length of the file associated with theStream.

◆ JReadFile() [1/3]

void JReadFile ( const JString fileName,
JString str 
)

Read characters from the std::fstream until the end of the file is reached. These functions takes a JString* because the contents of the file could be very large, and returning a JString requires twice as much memory because of the copy constructor.

These are equivalent to JReadAll() in jStreamUtil.h, except that they are optimized to work with file streams.

◆ JReadFile() [2/3]

void JReadFile ( std::fstream &  input,
JString str 
)

◆ JReadFile() [3/3]

void JReadFile ( std::ifstream &  input,
JString str 
)