Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/gradle/jhdf/commons-io-commons-…
Browse files Browse the repository at this point in the history
…io-2.17.0
  • Loading branch information
jamesmudd authored Sep 24, 2024
2 parents c57d2c3 + ac7b13f commit 87fabef
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ See [WriteHdf5.java](jhdf/src/main/java/io/jhdf/examples/WriteHdf5.java) for a
For more examples see package [io.jhdf.examples](jhdf/src/main/java/io/jhdf/examples)

## Why should I use jHDF?
- Easy integration with JVM based projects. The library is available on [Maven Central](https://search.maven.org/search?q=g:%22io.jhdf%22%20AND%20a:%22jhdf%22), and [GitHub Packages](https://github.com/jamesmudd/jhdf/packages/), so using it should be as easy as adding any other dependency. To use the libraries supplied by the HDF Group you need to load native code, which means you need to handle this in your build, and it complicates distribution of your software on multiple platforms.
- Easy integration with JVM based projects. The library is available on [Maven Central](https://central.sonatype.com/artifact/io.jhdf/jhdf), and [GitHub Packages](https://github.com/jamesmudd/jhdf/packages/), so using it should be as easy as adding any other dependency. To use the libraries supplied by the HDF Group you need to load native code, which means you need to handle this in your build, and it complicates distribution of your software on multiple platforms.
- The API design intends to be familiar to Java programmers, so hopefully it works as you might expect. (If this is not the case, open an issue with suggestions for improvement)
- No use of JNI, so you avoid all the issues associated with calling native code from the JVM.
- Fully debug-able you can step fully through the library with a Java debugger.
Expand Down
9 changes: 9 additions & 0 deletions jhdf/src/main/java/io/jhdf/api/dataset/ChunkedDataset.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,13 @@ public interface ChunkedDataset extends Dataset {
*/
ByteBuffer getRawChunkBuffer(int[] chunkOffset);

/**
* Gets the decompressed byte array for the specified chunk.
*
* @param chunkOffset the offset of the required chunk
* @return the decompressed byte array for this chunk
* @throws HdfException If the chunk offset is not valid for this dataset
*/
byte[] getDecompressedChunk(int[] chunkOffset);

}
10 changes: 10 additions & 0 deletions jhdf/src/main/java/io/jhdf/dataset/chunked/ChunkedDatasetBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,16 @@ public ByteBuffer getRawChunkBuffer(int[] chunkOffset) {
return getDataBuffer(chunk);
}

@Override
public byte[] getDecompressedChunk(int[] chunkOffset) {
final Chunk chunk = getChunk(new ChunkOffset(chunkOffset));
if (chunk == null) {
throw new HdfException("No chunk with offset " + Arrays.toString(chunkOffset) +
" in dataset: " + getPath());
}
return decompressChunk(chunk);
}

private Collection<Chunk> getAllChunks() {
return getChunkLookup().values();
}
Expand Down

0 comments on commit 87fabef

Please sign in to comment.