Go to the documentation of this file.
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();
368 :
std::basic_iostream<char,
std::char_traits<char> >(new TempFileBuffer(bufSize, keepflg))
369 , m_buffer(dynamic_cast<TempFileBuffer*>(rdbuf()))
375 :
std::basic_iostream<char,
std::char_traits<char> >(new TempFileBuffer(dir, bufSize, keepflg))
376 , m_buffer(dynamic_cast<TempFileBuffer*>(rdbuf()))
386 clear(rdstate() & ~std::ios::eofbit);
size_t write(const void *bfr, size_t numberOfBytes, Int64 offset=-1L)
Write to the underlying file.
std::streamsize m_writePos
BLOCXX_COMMON_API File createTempFile(String &filePath, const String &dir=String())
Create a tempororary file in an optional directory.
void reset()
reset puts the underlying stream object back into its initialized state.
UInt64 size() const
Current size of file.
String releaseFileAndReset()
releaseFileAndReset is like the reset method except it ensures all data has been flused to the underl...
This String class is an abstract data type that represents as NULL terminated string of characters.
void reset()
reset puts this stream object back into its initialized state.
#define BLOCXX_THROW(exType, msg)
Throw an exception using FILE and LINE.
void rewind()
Set the read/write position to the beginning of the data.
int close()
Close the underlying file object.
bool usingTempFile() const
void rewind()
Set the read/write position to the beginning of the data.
String releaseFileAndReset()
releaseFileAndReset is like the reset method except it ensures all data has been flused to the underl...
String & erase()
Delete all the characters of the string.
int buffer_from_device(char *c, int n)
size_t read(void *bfr, size_t numberOfBytes, Int64 offset=-1L) const
Read from the underlying 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.
virtual int overflow(int c)
std::streamsize m_readPos
int buffer_to_device(const char *c, int n)
AutoPtr< TempFileBuffer > m_buffer
std::streamsize xsputn(const char *s, std::streamsize n)
BLOCXX_COMMON_API bool removeFile(const String &path)
Remove the given file.
TempFileBuffer(size_t bufSize, EKeepFileFlag keepflg=E_DONT_KEEP_FILE)
Create a new TempFileBuffer object.
std::streamsize getSize()
bool usingTempFile() const
TempFileStream(size_t bufSize=4096, TempFileBuffer::EKeepFileFlag keepflg=TempFileBuffer::E_DONT_KEEP_FILE)
Create a new TempFileStream object.
Int64 seek(Int64 offset, int whence) const
Seek to a given offset within the file.