44#include "blocxx/BLOCXX_config.h"
58 , m_buffer(new char[m_bufSize])
74 , m_buffer(new char[m_bufSize])
134 int cnt = pptr() - pbase();
179 if (n < epptr() - pptr())
181 memcpy(pptr(), s, n *
sizeof(
char));
187 for (std::streamsize
i = 0;
i < n;
i++)
189 if (sputc(s[
i]) == EOF)
231 return static_cast<unsigned char>(*gptr());
291 return egptr() - eback();
300 rval += pptr() - pbase();
386 clear(rdstate() & ~std::ios::eofbit);
#define BLOCXX_THROW(exType, msg)
Throw an exception using FILE and LINE.
int close()
Close the underlying file object.
Int64 seek(Int64 offset, int whence) const
Seek to a given offset within the file.
size_t read(void *bfr, size_t numberOfBytes, Int64 offset=-1L) const
Read from the underlying file.
size_t write(const void *bfr, size_t numberOfBytes, Int64 offset=-1L)
Write to the underlying file.
UInt64 size() const
Current size of file.
This String class is an abstract data type that represents as NULL terminated string of characters.
String & erase()
Delete all the characters of the string.
std::streamsize getSize()
virtual int overflow(int c)
int buffer_to_device(const char *c, int n)
std::streamsize xsputn(const char *s, std::streamsize n)
int buffer_from_device(char *c, int n)
void reset()
reset puts this stream object back into its initialized state.
void rewind()
Set the read/write position to the beginning of the data.
std::streamsize m_readPos
TempFileBuffer(size_t bufSize, EKeepFileFlag keepflg=E_DONT_KEEP_FILE)
Create a new TempFileBuffer object.
std::streamsize m_writePos
bool usingTempFile() const
String releaseFileAndReset()
releaseFileAndReset is like the reset method except it ensures all data has been flused to the underl...
void rewind()
Set the read/write position to the beginning of the data.
bool usingTempFile() const
String releaseFileAndReset()
releaseFileAndReset is like the reset method except it ensures all data has been flused to the underl...
void reset()
reset puts the underlying stream object back into its initialized state.
AutoPtr< TempFileBuffer > m_buffer
TempFileStream(size_t bufSize=4096, TempFileBuffer::EKeepFileFlag keepflg=TempFileBuffer::E_DONT_KEEP_FILE)
Create a new TempFileStream object.
BLOCXX_COMMON_API bool removeFile(const String &path)
Remove the given file.
BLOCXX_COMMON_API File createAutoDeleteTempFile(const String &dir=String())
Create a tempororary file that will be removed when the returned File object is closed.
BLOCXX_COMMON_API File createTempFile(String &filePath, const String &dir=String())
Create a tempororary file in an optional directory.