SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
CachedDataWriter.java
1/*
2 * Class: CachedDataWriter
3 * Description:
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.*;
28import java.util.LinkedList;
29
37public abstract class CachedDataWriter extends AbstractDataWriter {
38
39 // don't use a map because ordering is important
40 protected LinkedList<DataField> fields;
41
42 protected LinkedList<DataField> getFields() {
43 return fields;
44 }
45
50 this.fields = new LinkedList<DataField>();
51 }
52
56
61 public void write(String label, String s) throws IOException {
62 fields.add(new DataField(label, s));
63 }
64
69 public void write(String label, int a) throws IOException {
70 fields.add(new DataField(label, a));
71 }
72
77 public void write(String label, float a) throws IOException {
78 fields.add(new DataField(label, a));
79 }
80
85 public void write(String label, double a) throws IOException {
86 fields.add(new DataField(label, a));
87 }
88
92
96
101 public void write(String label, String[] a, int n) throws IOException {
102 fields.add(new DataField(label, a.clone(), n));
103 }
104
109 public void write(String label, int[] a, int n) throws IOException {
110 fields.add(new DataField(label, a.clone(), n));
111 }
112
117 public void write(String label, float[] a, int n) throws IOException {
118 fields.add(new DataField(label, a.clone(), n));
119 }
120
125 public void write(String label, double[] a, int n) throws IOException {
126 fields.add(new DataField(label, a.clone(), n));
127 }
128
132
136
141 public void write(String label, String[][] a) throws IOException {
142 fields.add(new DataField(label, a.clone()));
143 }
144
149 public void write(String label, int[][] a) throws IOException {
150 fields.add(new DataField(label, a.clone()));
151 }
152
157 public void write(String label, float[][] a) throws IOException {
158 fields.add(new DataField(label, a.clone()));
159 }
160
165 public void write(String label, double[][] a) throws IOException {
166 fields.add(new DataField(label, a.clone()));
167 }
168
169}
170
This abstract class implements shared functionality for data writers.
void write(String label, float[][] a)
Writes a two-dimensional array of 32-bit floats (big endian).
void write(String label, float[] a, int n)
Writes the first n elements of a one-dimensional array of 32-bit floats (big endian).
void write(String label, double[][] a)
Writes a two-dimensional array of 64-bit doubles (big endian).
void write(String label, String[] a, int n)
Writes the first n elements of a one-dimensional array of strings.
void write(String label, double a)
Writes an atomic 64-bit double (big endian).
void write(String label, float a)
Writes an atomic 32-bit float (big endian).
void write(String label, String s)
Writes an atomic string field.
void write(String label, String[][] a)
Writes a two-dimensional array of strings.
void write(String label, int a)
Writes an atomic 32-bit integer (big endian).
void write(String label, double[] a, int n)
Writes the first n elements of a one-dimensional array of 64-bit doubles (big endian).
void write(String label, int[][] a)
Writes a two-dimensional array of 32-bit integers (big endian).
void write(String label, int[] a, int n)
Writes the first n elements of a one-dimensional array of 32-bit integers (big endian).
This class represents a data field from a file read by an instance of a class implementing DataReader...