/* */ #ifndef D_BINARY_STREAM_H #define D_BINARY_STREAM_H #include "common.h" #include #include "SharedHandle.h" namespace aria2 { class BinaryStream { public: virtual ~BinaryStream() {} virtual void writeData(const unsigned char* data, size_t len, off_t offset) = 0; virtual ssize_t readData(unsigned char* data, size_t len, off_t offset) = 0; // Truncates a file to given length. The default implementation does // nothing. virtual void truncate(uint64_t length) {} // Allocates given length bytes of disk space from given offset. The // default implementation does nothing. virtual void allocate(off_t offset, uint64_t length) {} }; typedef SharedHandle BinaryStreamHandle; } // namespace aria2 #endif // D_BINARY_STREAM_H