File: IHDF5Reader.java

package info (click to toggle)
libsis-jhdf5-java 19.04.0%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 8,668 kB
  • sloc: java: 79,644; ansic: 18,986; sh: 309; makefile: 49; xml: 12
file content (241 lines) | stat: -rw-r--r-- 7,549 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
/*
 * Copyright 2007 - 2018 ETH Zuerich, CISD and SIS.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package ch.systemsx.cisd.hdf5;

/**
 * An interface for reading HDF5 files (HDF5 1.10.x and older).
 * <p>
 * Obtain an object implementing this interface by calling {@link HDF5Factory#openForReading(String)} 
 * or {@link IHDF5ReaderConfigurator#reader()}.
 * <p>
 * The interface focuses on ease of use instead of completeness. As a consequence not all features
 * of HDF5 are supported by this class, however it covers a large subset. In particular all
 * information written by {@link IHDF5Writer} can be read by this class.
 * <p>
 * The functionality is being made available in two ways:
 * <ol>
 * <li>{@link IHDF5SimpleReader} contains the most important methods in one interface. If you are
 * new to the library, this is a good starting point, see the example code below.</li>
 * <li>The hierarchical ("quasi-fluent") API provides the full functionality. It is designed along
 * the data types supported by JHDF5.
 * <ul>
 * <li>{@link #file()}: File-level information and operations, has e.g. the
 * {@link IHDF5FileLevelReadOnlyHandler#close()} method.</li>
 * <li>{@link #object()}: Object-level information, where "objects" can be data sets, links, groups
 * or data types, following the concept of an HDF5 object. Here you can find for example the method
 * {@link IHDF5ObjectReadOnlyInfoProviderHandler#getGroupMemberInformation(String, boolean)} which
 * gives you information on the members of a group and the method
 * {@link IHDF5ObjectReadOnlyInfoProviderHandler#tryGetSymbolicLinkTarget(String)} for resolving a
 * symbolic link.</li>
 * <li>{@link #bool()}: Reader methods for boolean data sets, including bit fields.</li>
 * <li>{@link #int8()} / {@link #int16()} / {@link #int16()} / {@link #int32()} / {@link #int64()}:
 * Reader methods for integer data sets, where the number as part of the method name denotes the
 * size of the integer type. The methods will always read signed integers, if you need unsigned
 * integers, you need to convert them with one of the methods in {@link UnsignedIntUtils}.</li>
 * <li>{@link #float32()} / {@link #float64()}: Reader methods for float data sets, where the number
 * as part of the name sets the size of the float type.</li>
 * <li>{@link #time()} / {@link #duration()}: Reader methods for time stamp (or date) and for time
 * duration data sets.</li>
 * <li>{@link #string()}: Reader methods for string data sets.</li>
 * <li>{@link #enumeration()}: Reader methods for enumeration data sets.</li>
 * <li>{@link #compound()}: Reader methods for compound data sets.</li>
 * <li>{@link #opaque()}: Reader methods for data sets that are "black boxes" to HDF5 which are
 * called "opaque data sets" in HDF5 jargon. Here you can also find methods of reading arbitrary
 * data sets as byte arrays.</li>
 * <li>{@link #reference()}: Reader methods for HDF5 object references. Note that object references,
 * though similar to hard links and symbolic links on the first glance, are quite different for
 * HDF5.</li>
 * </ul>
 * </li>
 * </ol>
 * <p>
 * Usage example for {@link IHDF5SimpleReader}:
 * 
 * <pre>
 * IHDF5Reader reader = HDF5FactoryProvider.get().openForReading(new File(&quot;test.h5&quot;));
 * float[] f = reader.readFloatArray(&quot;/some/path/dataset&quot;);
 * String s = reader.getStringAttribute(&quot;/some/path/dataset&quot;, &quot;some key&quot;);
 * reader.close();
 * </pre>
 * 
 * @author Bernd Rinn
 */
public interface IHDF5Reader extends IHDF5SimpleReader
{

    // /////////////////////
    // File
    // /////////////////////

    /**
     * Returns the handler for file-level information and status.
     */
    public IHDF5FileLevelReadOnlyHandler file();

    // /////////////////////////////////
    // Objects, links, groups and types
    // /////////////////////////////////

    /**
     * Returns an info provider for HDF5 objects like links, groups, data sets and data types.
     */
    public IHDF5ObjectReadOnlyInfoProviderHandler object();

    // /////////////////////
    // Opaque
    // /////////////////////

    /**
     * Returns the full reader for reading data sets and attributes as byte arrays ('opaque') and
     * obtaining opaque types.
     */
    public IHDF5OpaqueReader opaque();

    // /////////////////////
    // Boolean
    // /////////////////////

    /**
     * Returns the full reader for boolean values.
     */
    public IHDF5BooleanReader bool();

    // /////////////////////
    // Bytes
    // /////////////////////

    /**
     * Returns the full reader for byte / int8.
     */
    public IHDF5ByteReader int8();

    /**
     * Returns the full reader for unsigned byte / uint8.
     */
    public IHDF5ByteReader uint8();

    // /////////////////////
    // Short
    // /////////////////////

    /**
     * Returns the full reader for short / int16.
     */
    public IHDF5ShortReader int16();

    /**
     * Returns the full reader for unsigned short / uint16.
     */
    public IHDF5ShortReader uint16();

    // /////////////////////
    // Int
    // /////////////////////

    /**
     * Returns the full reader for int / int32.
     */
    public IHDF5IntReader int32();

    /**
     * Returns the full reader for unsigned int / uint32.
     */
    public IHDF5IntReader uint32();

    // /////////////////////
    // Long
    // /////////////////////

    /**
     * Returns the full reader for long / int64.
     */
    public IHDF5LongReader int64();

    /**
     * Returns the full reader for unsigned long / uint64.
     */
    public IHDF5LongReader uint64();

    // /////////////////////
    // Float
    // /////////////////////

    /**
     * Returns the full reader for float / float32.
     */
    public IHDF5FloatReader float32();

    // /////////////////////
    // Double
    // /////////////////////

    /**
     * Returns the full reader for long / float64.
     */
    public IHDF5DoubleReader float64();

    // /////////////////////
    // Enums
    // /////////////////////

    /**
     * Returns the full reader for enumerations.
     */
    public IHDF5EnumReader enumeration();

    // /////////////////////
    // Compounds
    // /////////////////////

    /**
     * Returns the full reader for compounds.
     */
    public IHDF5CompoundReader compound();

    // /////////////////////
    // Strings
    // /////////////////////

    /**
     * Returns the full reader for strings.
     */
    public IHDF5StringReader string();

    // /////////////////////
    // Date & Time
    // /////////////////////

    /**
     * Returns the full reader for date and times.
     */
    public IHDF5DateTimeReader time();

    /**
     * Returns the full reader for time durations.
     */
    public IHDF5TimeDurationReader duration();

    // /////////////////////
    // Object references
    // /////////////////////

    /**
     * Returns the full reader for object references.
     */
    public IHDF5ReferenceReader reference();

}