Skip to content

Commit 3c3095b

Browse files
committed
Generate updates for 0.1.4 version.
1 parent d5695e7 commit 3c3095b

23 files changed

Lines changed: 523 additions & 6 deletions

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,17 @@ build/
3838
/*.h5
3939
hdf5/*/*.h5
4040
/bouml/
41+
/src/main/resources/h5ex_t/h5ex_t_array.h5
42+
/src/main/resources/h5ex_t/h5ex_t_bit.h5
43+
/src/main/resources/h5ex_t/h5ex_t_cmpd.h5
44+
/src/main/resources/h5ex_t/h5ex_t_commit.h5
45+
/src/main/resources/h5ex_t/h5ex_t_cpxcmpd.h5
46+
/src/main/resources/h5ex_t/h5ex_t_enum.h5
47+
/src/main/resources/h5ex_t/h5ex_t_float.h5
48+
/src/main/resources/h5ex_t/h5ex_t_int.h5
49+
/src/main/resources/h5ex_t/h5ex_t_objref.h5
50+
/src/main/resources/h5ex_t/h5ex_t_opaque.h5
51+
/src/main/resources/h5ex_t/h5ex_t_regref.h5
52+
/src/main/resources/h5ex_t/h5ex_t_string.h5
53+
/src/main/resources/h5ex_t/h5ex_t_vlen.h5
54+
/src/main/resources/h5ex_t/h5ex_t_vlstring.h5

src/main/java/org/hdf5javalib/dataclass/reference/HdfAttributeReference.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public HdfAttributeReference(byte[] bytes, ReferenceDatatype dt, boolean externa
1616
}
1717

1818
@Override
19-
public HdfDataHolder getData(HdfDataFile dataFile) {
19+
public HdfDataHolder getData() {
2020
throw new UnsupportedOperationException("Attribute Reference not supported yet.");
2121
}
2222
}

src/main/java/org/hdf5javalib/dataclass/reference/HdfDatasetRegionReference.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public String toString() {
6161
}
6262

6363
@Override
64-
public HdfDataHolder getData(HdfDataFile dataFile) {
64+
public HdfDataHolder getData() {
6565
return hdfDataHolder;
6666
}
6767
}

src/main/java/org/hdf5javalib/dataclass/reference/HdfObjectReference.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public String toString() {
153153
}
154154

155155
@Override
156-
public HdfDataHolder getData(HdfDataFile dataFile) {
156+
public HdfDataHolder getData() {
157157
return hdfDataHolder;
158158
}
159159
}

src/main/java/org/hdf5javalib/dataclass/reference/HdfReferenceInstance.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
import org.hdf5javalib.utils.HdfDataHolder;
55

66
public interface HdfReferenceInstance {
7-
HdfDataHolder getData(HdfDataFile dataFile);
7+
HdfDataHolder getData();
88
}

src/main/java/org/hdf5javalib/datatype/ReferenceDatatype.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public String toString(byte[] bytes) {
160160
// for (byte b : bytes) sb.append(String.format("%02X", b));
161161
// return "Reference[" + getReferenceType(classBitField).description + "]=" + sb;
162162
HdfReferenceInstance referenceInstance = getInstance(HdfReferenceInstance.class, bytes);
163-
HdfDataHolder data = referenceInstance.getData(dataFile);
163+
HdfDataHolder data = referenceInstance.getData();
164164
if ( data.isScalar()) {
165165
return data.getScalar().toString();
166166
} else {

src/main/java/org/hdf5javalib/examples/HDF5Examples/ReferenceRead.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ private void run() {
5858
// }
5959
try {
6060
// Path filePath = getResourcePath("HDF5Examples/h5ex_t_cpxcmpd.h5");
61-
Path filePath = getResourcePath("HDF5Examples/soft_link.h5");
61+
Path filePath = getResourcePath("HDF5Examples/h5ex_t_cpxcmpd.h5");
6262
System.out.println(filePath.toFile().getAbsolutePath());
6363
try (SeekableByteChannel channel = Files.newByteChannel(filePath, StandardOpenOption.READ)) {
6464
HdfFileReader reader = new HdfFileReader(channel).readFile();
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
package org.hdf5javalib.examples.h5ex_t;
2+
3+
import org.hdf5javalib.datasource.TypedDataSource;
4+
import org.hdf5javalib.hdfjava.HdfDataset;
5+
import org.hdf5javalib.hdfjava.HdfFileReader;
6+
7+
import java.io.IOException;
8+
import java.net.URISyntaxException;
9+
import java.nio.channels.SeekableByteChannel;
10+
import java.nio.file.Files;
11+
import java.nio.file.Path;
12+
import java.nio.file.Paths;
13+
import java.nio.file.StandardOpenOption;
14+
15+
import static org.hdf5javalib.utils.HdfDisplayUtils.displayData;
16+
17+
/**
18+
* Demonstrates reading and processing compound data from an HDF5 file.
19+
* <p>
20+
* The {@code CompoundRead} class serves as an example application that reads
21+
* a compound dataset from an HDF5 file, processes it using a {@link TypedDataSource},
22+
* and displays the results. It showcases filtering and mapping operations on the
23+
* dataset, as well as conversion to a custom Java class.
24+
* </p>
25+
*/
26+
public class h5ex_t_read {
27+
private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(h5ex_t_read.class);
28+
29+
/**
30+
* Entry point for the application.
31+
*
32+
* @param args command-line arguments (not used)
33+
*/
34+
public static void main(String[] args) {
35+
new h5ex_t_read().run();
36+
}
37+
38+
/**
39+
* Executes the main logic of reading and displaying compound data from an HDF5 file.
40+
*/
41+
private void run() {
42+
try {
43+
44+
// List all .h5 files in HDF5Examples resources directory
45+
Path dirPath = Paths.get(h5ex_t_read.class.getClassLoader().getResource("h5ex_t").toURI());
46+
Files.list(dirPath)
47+
.filter(p -> p.toString().endsWith(".h5"))
48+
.forEach(p -> {
49+
System.out.println("Running " + p.getFileName());
50+
displayFile(p);
51+
});
52+
} catch (URISyntaxException e) {
53+
throw new RuntimeException(e);
54+
} catch (IOException e) {
55+
throw new RuntimeException(e);
56+
}
57+
}
58+
59+
public void displayFile(Path filePath) {
60+
try (SeekableByteChannel channel = Files.newByteChannel(filePath, StandardOpenOption.READ)) {
61+
HdfFileReader reader = new HdfFileReader(channel).readFile();
62+
for (HdfDataset dataSet : reader.getDatasets()) {
63+
log.info("{} ", dataSet);
64+
displayData(channel, dataSet, reader);
65+
}
66+
} catch (Exception e) {
67+
log.error("Exception in displayFile: {}", filePath, e);
68+
}
69+
}
70+
}

0 commit comments

Comments
 (0)