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 =
static_cast<int>(fread((
char*) ptr + static_cast<int>(nUnused), 1, static_cast<int>(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.
GLsizei const GLchar *const * string
Base class for all exceptions thrown by ROS.
void advanceOffset(uint64_t nbytes)
void write(void *ptr, size_t size)
Exception thrown when on IO problems.
GLint GLint GLsizei GLint GLenum format
basic_format< char > format
void decompress(uint8_t *dest, unsigned int dest_len, uint8_t *source, unsigned int source_len)
CompressionType getCompressionType() const
void setUnused(char *unused)
GLsizei GLsizei GLchar * source
void read(void *ptr, size_t size)
UncompressedStream(ChunkedFile *file)