Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare release v0.8.0 #596

Merged
merged 9 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")));
}
}
Loading