public void testTable1() throws Exception {
Fits f = new Fits();
f.addHDU(Fits.makeHDU(new Object[]{bytes, bits, bools, shorts, ints,
floats, doubles, longs, strings}));
BinaryTableHDU bhdu = (BinaryTableHDU) f.getHDU(1);
bhdu.setColumnName(0, "bytes", null);
bhdu.setColumnName(1, "bits", "bits later on");
bhdu.setColumnName(6, "doubles", null);
bhdu.setColumnName(5, "floats", "4 x 4 array");
BufferedFile bf = new BufferedFile("bt1.fits", "rw");
f.write(bf);
bf.flush();
bf.close();
// read file
f = new Fits("bt1.fits");
BasicHDU hdu;
f.read();
for (int i = 0; i < f.getNumberOfHDUs(); i += 1) {
hdu = f.getHDU(i);
}
BinaryTableHDU thdu = (BinaryTableHDU) f.getHDU(1);
byte[] tb = (byte[]) thdu.getColumn(0);
byte[][] tbits = (byte[][]) thdu.getColumn(1);
boolean[] tbools = (boolean[]) thdu.getColumn(2);
short[][] tsh = (short[][]) thdu.getColumn(3);
int[] tints = (int[]) thdu.getColumn(4);
float[][][] tflt = (float[][][]) thdu.getColumn(5);
double[] tdoub = (double[]) thdu.getColumn(6);
long[] tlong = (long[]) thdu.getColumn(7);
String[] tstr = (String[]) thdu.getColumn(8);
for (int i = 0; i < tb.length; i += 1) {
assertEquals(bytes[i], tb[i]);
for (int j = 0; j < 2; j += 1) {
assertEquals(bits[i][j], tbits[i][j]);