public void write(FileSink output, String filename) throws IOException {
output.writeAll(this, filename);
}
public void write(String filename) throws IOException {
FileSink output = FileSinkFactory.sinkFor(filename);
if (output != null) {
write(output, filename);
} else {
throw new IOException("No sink writer for " + filename);
}