Search in sources :

Example 1 with ZipRecordWriter

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);
}
Also used : ZipRecordWriter(com.revolsys.record.io.format.zip.ZipRecordWriter) RecordWriter(com.revolsys.record.io.RecordWriter) ZipRecordWriter(com.revolsys.record.io.format.zip.ZipRecordWriter) PathResource(com.revolsys.spring.resource.PathResource) PathResource(com.revolsys.spring.resource.PathResource) Resource(com.revolsys.spring.resource.Resource) File(java.io.File)

Aggregations

RecordWriter (com.revolsys.record.io.RecordWriter)1 ZipRecordWriter (com.revolsys.record.io.format.zip.ZipRecordWriter)1 PathResource (com.revolsys.spring.resource.PathResource)1 Resource (com.revolsys.spring.resource.Resource)1 File (java.io.File)1