Skip to content

Commit

Permalink
Merge pull request #596 from jamesmudd/release-v0.8.0
Browse files Browse the repository at this point in the history
Prepare release v0.8.0
  • Loading branch information
jamesmudd authored Jul 22, 2024
2 parents bf85a6f + 58776a9 commit 6753c81
Show file tree
Hide file tree
Showing 7 changed files with 126 additions and 55 deletions.
53 changes: 0 additions & 53 deletions .github/pom.xml

This file was deleted.

10 changes: 10 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# jHDF Change Log

## v0.8.0 - July 2024
- Major writing support improvements
- Attributes can now be written https://github.com/jamesmudd/jhdf/issues/552
- Full support for `byte`, `short`, `int`, `long`, `float`, `double` and wrapper classes as datasets and attributes https://github.com/jamesmudd/jhdf/discussions/587
- Support for scalar datasets and attributes
- Much more complete API on writable objects, allowing introspection of data type and data layout and data space etc.
- Many test improvements for writing support
- Build and dependency updates
- Note: This may be the last release supporting Java 8

## v0.7.0 - May 2024
- Release adding HDF5 writing support! https://github.com/jamesmudd/jhdf/issues/354. Special thanks to [@thadguidry](https://github.com/thadguidry) for sponsoring this work. See [WriteHdf5.java](jhdf/src/main/java/io/jhdf/examples/WriteHdf5.java) for example usage. Supports
- Groups
Expand Down
4 changes: 2 additions & 2 deletions jhdf/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ plugins {

// Variables
group = 'io.jhdf'
version = '0.7.0'
version = '0.8.0'

compileJava {
sourceCompatibility = "1.8"
Expand Down Expand Up @@ -142,7 +142,7 @@ publishing {
pom {
name = 'jhdf'
description = 'A pure Java HDF5 library'
url = 'http://jhdf.io/'
url = 'https://jhdf.io/'
licenses {
license {
name = 'MIT License'
Expand Down
23 changes: 23 additions & 0 deletions jhdf/src/main/java/io/jhdf/api/WritableNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,31 @@

public interface WritableNode extends Node {

/**
* Writes this node to the file. Not for general use
*
* @param hdfFileChannel The file channel to write this node to
* @param position The position in the file to write this node
* @return bytes written
*/
long write(HdfFileChannel hdfFileChannel, long position);

/**
* Adds an attribute to this node
*
* @since v0.8.0
* @param name The attributes name
* @param data The attributes data
* @return The attribute
*/
Attribute putAttribute(String name, Object data);

/**
* Removes an attribute from this node
*
* @since v0.8.0
* @param name The attribute to remove
* @return The removed attribute
*/
Attribute removeAttribute(String name);
}
34 changes: 34 additions & 0 deletions jhdf/src/main/java/io/jhdf/examples/WriteAttributes.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* This file is part of jHDF. A pure Java library for accessing HDF5 files.
*
* http://jhdf.io
*
* Copyright (c) 2024 James Mudd
*
* MIT License see 'LICENSE' file
*/
package io.jhdf.examples;

import io.jhdf.HdfFile;
import io.jhdf.WritableHdfFile;
import io.jhdf.api.WritiableDataset;

import java.nio.file.Paths;

/**
* Example application for writing attributes
*
* @author James Mudd
*/
public class WriteAttributes {
public static void main(String[] args) {
try (WritableHdfFile hdfFile = HdfFile.write(Paths.get("attributes.hdf5"))) {
// write scalar attribute on the root group
hdfFile.putAttribute("example_group_attribute", 55.543);

// Write a dataset
WritiableDataset dataset = hdfFile.putDataset("ints", new int[]{1, 2, 3, 4});
dataset.putAttribute("example_ints_attribute", new int[] {1, 2, 3, 4});
}
}
}
28 changes: 28 additions & 0 deletions jhdf/src/test/java/io/jhdf/examples/WriteAttributesTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* This file is part of jHDF. A pure Java library for accessing HDF5 files.
*
* http://jhdf.io
*
* Copyright (c) 2024 James Mudd
*
* MIT License see 'LICENSE' file
*/
package io.jhdf.examples;

import org.junit.jupiter.api.Test;

import java.nio.file.Files;
import java.nio.file.Paths;

import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertTrue;

class WriteAttributesTest {
@Test
void testWriteAttributes() {
assertDoesNotThrow(() ->
WriteAttributes.main(new String[]{}));

assertTrue(Files.exists(Paths.get("attributes.hdf5")));
}
}
29 changes: 29 additions & 0 deletions jhdf/src/test/java/io/jhdf/examples/WriteHdf5Test.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* This file is part of jHDF. A pure Java library for accessing HDF5 files.
*
* http://jhdf.io
*
* Copyright (c) 2024 James Mudd
*
* MIT License see 'LICENSE' file
*/
package io.jhdf.examples;

import org.junit.jupiter.api.Test;

import java.nio.file.Files;
import java.nio.file.Paths;

import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertTrue;

class WriteHdf5Test {

@Test
void testWriteHdf5() {
assertDoesNotThrow(() ->
WriteHdf5.main(new String[]{}));

assertTrue(Files.exists(Paths.get("jhdf.hdf5")));
}
}

0 comments on commit 6753c81

Please sign in to comment.