use of com.revolsys.record.io.format.zip.ZipRecordWriter in project com.revolsys.open by revolsys.
the class ShapefileZip method newRecordWriter.
@Override
public RecordWriter newRecordWriter(final String baseName, final RecordDefinition recordDefinition, final OutputStream outputStream, final Charset charset) {
File directory;
try {
directory = FileUtil.newTempDirectory(baseName, "zipDir");
} catch (final Throwable e) {
throw new RuntimeException("Unable to create temporary directory", e);
}
final Resource tempResource = new PathResource(new File(directory, baseName + ".shp"));
final RecordWriter shapeWriter = new ShapefileRecordWriter(recordDefinition, tempResource);
return new ZipRecordWriter(directory, shapeWriter, outputStream);
}
Aggregations