-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #596 from jamesmudd/release-v0.8.0
Prepare release v0.8.0
- Loading branch information
Showing
7 changed files
with
126 additions
and
55 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
28
jhdf/src/test/java/io/jhdf/examples/WriteAttributesTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"))); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"))); | ||
} | ||
} |