Skip to content

Conversation

@jsaarimaa
Copy link
Collaborator

Introduce BinaryValueCodecSelector for optimal codec choice based on DoubleDataValue range, sign, and type. Add BinaryValueCodecType enum for stable mapping. Refactor all codecs to use a consistent ByteCount property and update buffer logic for compatibility. Enhance BinaryDataReader to support headerLengthBytes, ensuring correct offset handling for chunked and stream reads. Add comprehensive unit tests for codec selection and header offset logic. Improve robustness and readability of binary IO code.

Introduce BinaryValueCodecSelector for optimal codec choice based on DoubleDataValue range, sign, and type. Add BinaryValueCodecType enum for stable mapping. Refactor all codecs to use a consistent ByteCount property and update buffer logic for compatibility. Enhance BinaryDataReader to support headerLengthBytes, ensuring correct offset handling for chunked and stream reads. Add comprehensive unit tests for codec selection and header offset logic. Improve robustness and readability of binary IO code.
@jsaarimaa jsaarimaa requested a review from Copilot January 19, 2026 07:18
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the binary data IO subsystem by introducing automatic codec selection based on value characteristics and adding header offset support for reading binary data streams. The changes improve memory efficiency through optimal codec selection and enable reading of binary files with metadata headers.

Changes:

  • Introduce BinaryValueCodecSelector to automatically choose the most compact codec based on value range, sign, and precision requirements
  • Add BinaryValueCodecType enum for stable codec mapping
  • Refactor all codec implementations to use consistent ByteCount as a compile-time constant
  • Add header offset support to BinaryDataReader for both seekable and non-seekable streams
  • Add comprehensive unit tests for codec selection logic and header offset handling

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
BinaryValueCodecType.cs New enum defining all supported codec types with explicit integer values
BinaryValueCodecSelector.cs New class implementing automatic codec selection based on data value analysis
BinaryValueCodecBase.cs Updated to use consistent byteCount parameter naming
UInt16Codec.cs Refactored to use const ByteCount and primary constructor
UInt24Codec.cs Refactored to use const ByteCount
UInt32Codec.cs Refactored to use const ByteCount
Int16Codec.cs Refactored to use const ByteCount and primary constructor
Int24Codec.cs Refactored to use const ByteCount
Int32Codec.cs Refactored to use const ByteCount
FloatCodec.cs Refactored to use const ByteCount
DoubleCodec.cs Refactored to use const ByteCount
BinaryDataReader.cs Added headerLengthBytes parameter and offset calculations for both seekable and non-seekable streams
BinaryValueCodecSelectorTests.cs Comprehensive unit tests for codec selection logic
BinaryDataReaderStreamTests.cs Unit tests validating header offset handling in stream reads
BinaryDataReaderChunkTests.cs Unit tests validating header offset handling in chunked reads

@jsaarimaa jsaarimaa merged commit bb348a7 into dev Jan 19, 2026
8 checks passed
@jsaarimaa jsaarimaa deleted the feature/binary-codec-selector branch January 19, 2026 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants