SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
DataReader.java
1/*
2 * Class: DataReader
3 * Description: Data reader interface
4 * Environment: Java
5 * Software: SSJ
6 * Copyright (C) 2001 Pierre L'Ecuyer and Universite de Montreal
7 * Organization: DIRO, Universite de Montreal
8 * @author David Munger
9 * @since August 2009
10 *
11 *
12 * Licensed under the Apache License, Version 2.0 (the "License");
13 * you may not use this file except in compliance with the License.
14 * You may obtain a copy of the License at
15 *
16 * http://www.apache.org/licenses/LICENSE-2.0
17 *
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an "AS IS" BASIS,
20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
23 *
24 */
25package umontreal.ssj.util.io;
26
27import java.io.IOException;
28import java.util.Map;
29
35public interface DataReader {
36
40
44 public String readString(String label) throws IOException;
45
49 public int readInt(String label) throws IOException;
50
54 public float readFloat(String label) throws IOException;
55
59 public double readDouble(String label) throws IOException;
60
64
68
73 public String[] readStringArray(String label) throws IOException;
74
79 public int[] readIntArray(String label) throws IOException;
80
85 public float[] readFloatArray(String label) throws IOException;
86
91 public double[] readDoubleArray(String label) throws IOException;
92
96
100
105 public String[][] readStringArray2D(String label) throws IOException;
106
111 public int[][] readIntArray2D(String label) throws IOException;
112
117 public float[][] readFloatArray2D(String label) throws IOException;
118
123 public double[][] readDoubleArray2D(String label) throws IOException;
124
128
132
138 public Map<String, DataField> readAllNextFields() throws IOException;
139
145 public Map<String, DataField> readAllFields() throws IOException;
146
152 public DataField readNextField() throws IOException;
153
159 public DataField readField(String label) throws IOException;
160
164
168
172 public void close() throws IOException;
173
178 public void reset() throws IOException;
179
183 public boolean dataPending() throws IOException;
184
185}
186
This class represents a data field from a file read by an instance of a class implementing DataReader...
double[][] readDoubleArray2D(String label)
Reads the first field labeled as label and returns its value as a two-dimensional array of double’s.
int readInt(String label)
Reads the first field labeled as label and returns its int value.
DataField readNextField()
Reads the next available field.
void close()
Closes the input stream.
float[][] readFloatArray2D(String label)
Reads the first field labeled as label and returns its value as a two-dimensional array of float’s.
boolean dataPending()
Returns true if there remains data to be read.
float readFloat(String label)
Reads the first field labeled as label and returns its float value.
void reset()
Resets the reader to its initial state, i.e.
int[] readIntArray(String label)
Reads the first field labeled as label and returns its value as a one-dimensional array of int’s.
float[] readFloatArray(String label)
Reads the first field labeled as label and returns its value as a one-dimensional array of float’s.
String[] readStringArray(String label)
Reads the first field labeled as label and returns its value as a one-dimensional array of String’s.
double readDouble(String label)
Reads the first field labeled as label and returns its double value.
Map< String, DataField > readAllFields()
Reads all fields in the file and returns a hashmap indexed by field labels.
Map< String, DataField > readAllNextFields()
Reads all remaining fields in the file and returns a hashmap indexed by field labels.
String[][] readStringArray2D(String label)
Reads the first field labeled as label and returns its value as a two-dimensional array of String’s.
double[] readDoubleArray(String label)
Reads the first field labeled as label and returns its value as a one-dimensional array of double’s.
DataField readField(String label)
Reads the first field labeled as label.
String readString(String label)
Reads the first field labeled as label and returns its String value.
int[][] readIntArray2D(String label)
Reads the first field labeled as label and returns its value as a two-dimensional array of int’s.