@@ -284,7 +284,7 @@ struct OPENVDB_API ReadDiagnostics {
284284// / In the read and write methods, downcast the reference back to the concrete
285285// / type to access the extra fields:
286286// / @code
287- // / void readBuffers(std::istream& is, io::CodecData& data, ...) override {
287+ // / void readBuffers(std::istream& is, int64_t size, io::CodecData& data, ...) const override {
288288// / auto& myData = static_cast<MyCodecData&>(data);
289289// / MyGridType& grid = static_cast<MyGridType&>(*myData.grid);
290290// / // Use myData.intermediateBuffer, grid, etc.
@@ -350,15 +350,15 @@ struct OPENVDB_API CodecData
350350// / @code
351351// / void readTopology(std::istream& is, io::CodecData& data,
352352// / const io::ReadOptions& options,
353- // / io::ReadDiagnostics& diagnostics) override
353+ // / io::ReadDiagnostics& diagnostics) const override
354354// / {
355355// / MyGridType& grid = static_cast<MyGridType&>(*data.grid);
356356// / // Deserialize the tree structure into grid...
357357// / }
358358// /
359- // / void readBuffers(std::istream& is, io:: CodecData& data,
359+ // / void readBuffers(std::istream& is, int64_t size, CodecData& data,
360360// / const io::ReadOptions& options,
361- // / io::ReadDiagnostics& diagnostics) override
361+ // / io::ReadDiagnostics& diagnostics) const override
362362// / {
363363// / if (options.readMode == io::ReadMode::TopologyOnly) return;
364364// / MyGridType& grid = static_cast<MyGridType&>(*data.grid);
@@ -397,7 +397,7 @@ struct OPENVDB_API Codec
397397 // / @brief Deserialize the grid topology (tree structure and active-voxel
398398 // / mask) from @a is into the grid held by @a data.
399399 virtual void readTopology (std::istream& /* is*/ , CodecData& /* data*/ ,
400- const ReadOptions& /* options*/ , ReadDiagnostics& /* diagnostics*/ ) { }
400+ const ReadOptions& /* options*/ , ReadDiagnostics& /* diagnostics*/ ) const { }
401401
402402 // / @brief Deserialize all voxel-value buffers from @a is into the grid
403403 // / held by @a data.
@@ -410,9 +410,11 @@ struct OPENVDB_API Codec
410410 // / restrict the loaded data to the region that intersects it; if the codec
411411 // / cannot honour clipping natively, fall back to a post-process and record
412412 // / a warning via @a diagnostics. The @c size argument is the number of bytes
413- // / occupied by the entire readBuffers data section.
414- virtual void readBuffers (std::istream& /* is*/ , Index64 /* size*/ , CodecData& /* data*/ ,
415- const ReadOptions& /* options*/ , ReadDiagnostics& /* diagnostics*/ ) { }
413+ // / occupied by the readBuffers data section, measured from the stream
414+ // / position at which this method is called, or -1 when the size is not known
415+ // / (a non-seekable stream, or a stream without grid offsets).
416+ virtual void readBuffers (std::istream& /* is*/ , int64_t /* size*/ , CodecData& /* data*/ ,
417+ const ReadOptions& /* options*/ , ReadDiagnostics& /* diagnostics*/ ) const { }
416418
417419 // / @brief Serialize the grid topology (tree structure and active-voxel
418420 // / mask) from @a grid to @a os.
@@ -421,14 +423,14 @@ struct OPENVDB_API Codec
421423 // / topology as a distinct section that precedes the value buffers in the
422424 // / stream.
423425 virtual void writeTopology (std::ostream& /* os*/ , const GridBase& /* grid*/ ,
424- const WriteOptions& /* options*/ ) { }
426+ const WriteOptions& /* options*/ ) const { }
425427
426428 // / @brief Serialize all voxel-value buffers from @a grid to @a os.
427429 // /
428430 // / The default implementation is a no-op. Override to write the leaf-node
429431 // / value buffers that follow the topology section.
430432 virtual void writeBuffers (std::ostream& /* os*/ , const GridBase& /* grid*/ ,
431- const WriteOptions& /* options*/ ) { }
433+ const WriteOptions& /* options*/ ) const { }
432434}; // struct Codec
433435
434436// / @brief A thread-safe, process-global registry that maps codec names to
0 commit comments