A = c.read();
} catch (IOException e) {
assert(false);
}
assert(A instanceof ArrayChar);
ArrayChar ac = (ArrayChar) A;
String val = ac.getString(ac.getIndex());
assert val.equals("Testing 1-2-3") : val;
//System.out.println( "val = "+ val);
// read char variable 2
Variable c2 = null;
assert(null != (c2 = ncfile.findVariable("svar2")));
try {
A = c2.read();
} catch (IOException e) {
assert(false);
}
assert(A instanceof ArrayChar);
ArrayChar ac2 = (ArrayChar) A;
assert(ac2.getString().equals("Two pairs of ladies stockings!"));
// read String Array
Variable c3 = null;
assert(null != (c3 = ncfile.findVariable("names")));
try {
A = c3.read();
} catch (IOException e) {
assert(false);
}
assert(A instanceof ArrayChar);
ArrayChar ac3 = (ArrayChar) A;
ima = ac3.getIndex();
assert(ac3.getString(ima.set(0)).equals("No pairs of ladies stockings!"));
assert(ac3.getString(ima.set(1)).equals("One pair of ladies stockings!"));
assert(ac3.getString(ima.set(2)).equals("Two pairs of ladies stockings!"));
// read String Array - 2
Variable c4 = null;
assert(null != (c4 = ncfile.findVariable("names2")));
try {
A = c4.read();
} catch (IOException e) {
assert(false);
}
assert(A instanceof ArrayChar);
ArrayChar ac4 = (ArrayChar) A;
ima = ac4.getIndex();
assert(ac4.getString(0).equals("0 pairs of ladies stockings!"));
assert(ac4.getString(1).equals("1 pair of ladies stockings!"));
assert(ac4.getString(2).equals("2 pairs of ladies stockings!"));
//System.out.println( "ncfile = "+ ncfile);
ncfile.close();
System.out.println( "**************TestRead done");