40 #include <boost/format.hpp> 57 throw BagIOException((format(
"Error writing to file: writing %1% bytes, wrote %2% bytes") % size % result).str());
68 if (nUnused == size) {
70 memcpy(ptr, unused, nUnused);
74 else if (nUnused < size) {
76 memcpy(ptr, unused, nUnused);
82 int result = fread((
char*) ptr + nUnused, 1, size,
getFilePointer());
83 if ((
size_t) result != size)
84 throw BagIOException((format(
"Error reading from file + unused: wanted %1% bytes, read %2% bytes") % size % result).str());
92 memcpy(ptr, unused, size);
101 if ((
size_t) result != size)
102 throw BagIOException((format(
"Error reading from file: wanted %1% bytes, read %2% bytes") % size % result).str());
108 if (dest_len < source_len)
111 memcpy(dest, source, source_len);
ChunkedFile reads and writes files which contain interleaved chunks of compressed and uncompressed da...
void setUnusedLength(int nUnused)
Base class for rosbag exceptions.
CompressionType getCompressionType() const
void advanceOffset(uint64_t nbytes)
void write(void *ptr, size_t size)
Exception thrown when on IO problems.
void decompress(uint8_t *dest, unsigned int dest_len, uint8_t *source, unsigned int source_len)
void setUnused(char *unused)
void read(void *ptr, size_t size)
UncompressedStream(ChunkedFile *file)