JX Application Framework
Loading...
Searching...
No Matches
Classes | Functions
jStreamUtil.h File Reference
#include "jTypes.h"
Include dependency graph for jStreamUtil.h:
This graph shows which files directly or indirectly include this file:

Classes

class  charbuf
 
class  icharbufstream
 

Functions

void JCopyBinaryData (std::istream &input, std::ostream &output, const JSize byteCount)
 
JString JRead (std::istream &input, const JSize count)
 
JString JReadUntil (std::istream &input, const JUtf8Byte delimiter, bool *foundDelimiter=nullptr)
 
JString JReadUntilws (std::istream &input, bool *foundws=nullptr)
 
JString JReadLine (std::istream &input, bool *foundNewLine=nullptr)
 
void JReadAll (std::istream &input, JString *str)
 
bool JReadUntil (std::istream &input, const JSize delimiterCount, const JUtf8Byte *delimiters, JString *str, JUtf8Byte *delimiter=nullptr)
 
void JIgnoreUntil (std::istream &input, const JUtf8Byte delimiter, bool *foundDelimiter=nullptr)
 
void JIgnoreUntil (std::istream &input, const JUtf8Byte *delimiter, bool *foundDelimiter=nullptr)
 
bool JIgnoreUntil (std::istream &input, const JSize delimiterCount, const JUtf8Byte *delimiters, JUtf8Byte *delimiter=nullptr)
 
void JIgnoreLine (std::istream &input, bool *foundNewLine=nullptr)
 
void JEncodeBase64 (std::istream &input, std::ostream &output)
 
bool JDecodeBase64 (std::istream &input, std::ostream &output)
 
JString JRead (const int input, const JSize count)
 
JString JReadUntil (const int input, const JUtf8Byte delimiter, bool *foundDelimiter=nullptr)
 
bool JReadAll (const int input, JString *str, const bool closeInput=true)
 
bool JReadUntil (const int input, const JSize delimiterCount, const JUtf8Byte *delimiters, JString *str, JUtf8Byte *delimiter=nullptr)
 
void JIgnoreUntil (const int input, const JUtf8Byte delimiter, bool *foundDelimiter=nullptr)
 
void JIgnoreUntil (const int input, const JUtf8Byte *delimiter, bool *foundDelimiter=nullptr)
 
bool JIgnoreUntil (const int input, const JSize delimiterCount, const JUtf8Byte *delimiters, JUtf8Byte *delimiter=nullptr)
 
bool JWaitForInput (const int input, const time_t timeout)
 
JSize JTellg (std::istream &stream)
 
void JSeekg (std::istream &stream, std::streampos position)
 
void JSeekg (std::istream &stream, std::streamoff offset, JIOStreamSeekDir direction)
 
JSize JTellp (std::ostream &stream)
 
void JSeekp (std::ostream &stream, std::streampos position)
 
void JSeekp (std::ostream &stream, std::streamoff offset, JIOStreamSeekDir direction)
 
void JSetState (std::ios &stream, const int flag)
 

Function Documentation

◆ JCopyBinaryData()

void JCopyBinaryData ( std::istream &  input,
std::ostream &  output,
const JSize  byteCount 
)

Copies binary data from input to output. Caller must set initial read and write marks.

◆ JDecodeBase64()

bool JDecodeBase64 ( std::istream &  input,
std::ostream &  output 
)

◆ JEncodeBase64()

void JEncodeBase64 ( std::istream &  input,
std::ostream &  output 
)

◆ JIgnoreLine()

void JIgnoreLine ( std::istream &  input,
bool foundNewLine 
)

Toss characters from the std::istream until newline ('
', '\r', '\r
') is reached. newline is read in and discarded.

If foundNewLine is not nullptr, it tells whether or not the end of a line was actually encountered.

◆ JIgnoreUntil() [1/6]

bool JIgnoreUntil ( const int  input,
const JSize  delimiterCount,
const JUtf8Byte delimiters,
JUtf8Byte delimiter 
)

Toss characters from the std::istream until one of the delimiters is reached. delimiter is read in and discarded.

Returns true if a delimited is found. *delimiter is then set to the delimiter that was found.

Returns false if it encounters an error or end-of-stream instead of a delimiter. *delimiter is not changed.

delimiter can be nullptr.

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

◆ JIgnoreUntil() [2/6]

void JIgnoreUntil ( const int  input,
const JUtf8Byte delimiter,
bool foundDelimiter = nullptr 
)

◆ JIgnoreUntil() [3/6]

void JIgnoreUntil ( const int  input,
const JUtf8Byte  delimiter,
bool foundDelimiter 
)

Discard characters from the std::istream until delimiter is reached. delimiter is read in and discarded.

If foundDelimiter is not nullptr, it tells whether or not the delimiter was actually found.

To keep the prototype as close to JReadUntil() as possible, foundDelimiter is not the return value.

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

◆ JIgnoreUntil() [4/6]

bool JIgnoreUntil ( std::istream &  input,
const JSize  delimiterCount,
const JUtf8Byte delimiters,
JUtf8Byte delimiter 
)

Toss characters from the std::istream until one of the delimiters is reached. delimiter is read in and discarded.

Returns true if a delimited is found. *delimiter is then set to the delimiter that was found.

Returns false if it encounters an error or end-of-stream instead of a delimiter. *delimiter is not changed.

delimiter can be nullptr.

◆ JIgnoreUntil() [5/6]

void JIgnoreUntil ( std::istream &  input,
const JUtf8Byte delimiter,
bool foundDelimiter = nullptr 
)

◆ JIgnoreUntil() [6/6]

void JIgnoreUntil ( std::istream &  input,
const JUtf8Byte  delimiter,
bool foundDelimiter 
)

Discard characters from the std::istream until delimiter is reached. delimiter is read in and discarded.

If foundDelimiter is not nullptr, it tells whether or not the delimiter was actually found.

To keep the prototype as close to JReadUntil() as possible, foundDelimiter is not the return value.

◆ JRead() [1/2]

JString JRead ( const int  input,
const JSize  count 
)

Read the specified number of characters from the stream.

◆ JRead() [2/2]

JString JRead ( std::istream &  input,
const JSize  count 
)

Read the specified number of characters from the stream.

◆ JReadAll() [1/2]

bool JReadAll ( const int  input,
JString str,
const bool  closeInput 
)

Read characters until the end of the data stream is reached. This function takes a JString* because the contents of the stream could be very large, and returning a JString requires twice as much memory because of the copy constructor.

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

◆ JReadAll() [2/2]

void JReadAll ( std::istream &  input,
JString str 
)

Read characters until the end of the std::istream is reached. This function takes a JString* because the contents of the stream could be very large, and returning a JString requires twice as much memory because of the copy constructor.

Not inline to avoid including JString.h in header file.

◆ JReadLine()

JString JReadLine ( std::istream &  input,
bool foundNewLine 
)

Read characters from the std::istream until newline ('
', '\r', '\r
') is reached. newline is read in and discarded.

If foundNewLine is not nullptr, it tells whether or not the end of a line was actually encountered.

◆ JReadUntil() [1/4]

bool JReadUntil ( const int  input,
const JSize  delimiterCount,
const JUtf8Byte delimiters,
JString str,
JUtf8Byte delimiter 
)

Read characters from the std::istream until one of the delimiters is reached. delimiter is read in and discarded.

Returns true if a delimited is found. *delimiter is then set to the delimiter that was found.

Returns false if it encounters an error or end-of-stream instead of a delimiter. *delimiter is not changed.

delimiter can be nullptr.

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

◆ JReadUntil() [2/4]

JString JReadUntil ( const int  input,
const JUtf8Byte  delimiter,
bool foundDelimiter 
)

Read characters from the std::istream until delimiter is reached. delimiter is read in and discarded.

If foundDelimiter is not nullptr, it tells whether or not the delimiter was actually found.

◆ JReadUntil() [3/4]

bool JReadUntil ( std::istream &  input,
const JSize  delimiterCount,
const JUtf8Byte delimiters,
JString str,
JUtf8Byte delimiter 
)

Read characters from the std::istream until one of the delimiters is reached. delimiter is read in and discarded.

Returns true if a delimited is found. *delimiter is then set to the delimiter that was found.

Returns false if it encounters an error or end-of-stream instead of a delimiter. *delimiter is not changed.

delimiter can be nullptr.

◆ JReadUntil() [4/4]

JString JReadUntil ( std::istream &  input,
const JUtf8Byte  delimiter,
bool foundDelimiter 
)

Read characters from the std::istream until delimiter is reached. delimiter is read in and discarded.

If foundDelimiter is not nullptr, it tells whether or not the delimiter was actually found.

◆ JReadUntilws()

JString JReadUntilws ( std::istream &  input,
bool foundws 
)

Read characters from the std::istream until white-space is reached. white-space is read in and discarded.

If foundws is not nullptr, it tells whether or not whitespace was actually encountered.

◆ JSeekg() [1/2]

void JSeekg ( std::istream &  stream,
std::streamoff  offset,
JIOStreamSeekDir  direction 
)

◆ JSeekg() [2/2]

void JSeekg ( std::istream &  stream,
std::streampos  position 
)

◆ JSeekp() [1/2]

void JSeekp ( std::ostream &  stream,
std::streamoff  offset,
JIOStreamSeekDir  direction 
)

◆ JSeekp() [2/2]

void JSeekp ( std::ostream &  stream,
std::streampos  position 
)

◆ JSetState()

void JSetState ( std::ios &  stream,
const int  flag 
)

◆ JTellg()

JSize JTellg ( std::istream &  stream)

◆ JTellp()

JSize JTellp ( std::ostream &  stream)

◆ JWaitForInput()

bool JWaitForInput ( const int  input,
const time_t  timeout 
)

Wait until there is data available or until it times out. timeout is in seconds.