}
header.setNumRecords(values.length);
FileOutputStream fos = new FileOutputStream(tmp);
WritableByteChannel channel = fos.getChannel();
tmp.deleteOnExit();
DbaseFileWriter writer = new DbaseFileWriter(header, channel, cs, tz);
// write records such that the i-th row has nulls in every column except the i-th column
for (int row = 0; row < values.length; row++) {
Object[] current = new Object[values.length];
Arrays.fill(current, null);
current[row] = values[row];
writer.write(current);
}
writer.close();
fos.flush();
fos.close();
DbaseFileReader reader = new DbaseFileReader(new FileInputStream(tmp).getChannel(), false, cs, tz);
assertTrue("Number of records does not match", values.length == reader.getHeader().getNumRecords());
for (int row = 0; row < values.length; row++) {