Skip to content

Add flat-slice dataset access (getDataFlat with offset)#789

Draft
jamesmudd wants to merge 1 commit intomasterfrom
codex/implement-pr-for-issue-726-with-tests
Draft

Add flat-slice dataset access (getDataFlat with offset)#789
jamesmudd wants to merge 1 commit intomasterfrom
codex/implement-pr-for-issue-726-with-tests

Conversation

@jamesmudd
Copy link
Owner

Motivation

  • Provide an API to read a flattened (1D) view of a sliced dataset so callers can efficiently request a contiguous flattened slice without post-processing.

Description

  • Add Object getDataFlat(long[] sliceOffset, int[] sliceDimensions) to the Dataset interface.
  • Implement flat-slice reading in DatasetBase by validating the slice, obtaining the slice buffer, computing total elements, and delegating to DatasetReader.
  • Reject flat-slice requests for writable datasets by throwing HdfWritingException in WritableDatasetImpl to match existing slicing behavior.
  • Add tests in SlicingTest to verify flat-slice correctness and error cases for empty and scalar datasets.

Testing

  • Ran ./gradlew test --tests io.jhdf.dataset.SlicingTest and all tests in that suite passed (build completed successfully with minor Gradle configuration warnings).

Codex Task

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 9, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant