Search in sources :

Example 1 with ZipDumpWriteBlobStore

use of com.enonic.xp.repo.impl.dump.blobstore.ZipDumpWriteBlobStore in project xp by enonic.

the class ZipDumpWriter method create.

public static ZipDumpWriter create(final Path basePath, final String dumpName, final BlobStore blobStore) {
    Preconditions.checkArgument(FileNames.isSafeFileName(dumpName));
    try {
        final ZipArchiveOutputStream zipArchiveOutputStream = new ZipArchiveOutputStream(Files.newByteChannel(basePath.resolve(dumpName + ZIP_FILE_EXTENSION), StandardOpenOption.CREATE, StandardOpenOption.WRITE, StandardOpenOption.READ, StandardOpenOption.TRUNCATE_EXISTING));
        final ZipDumpWriteBlobStore zipDumpWriteBlobStore = new ZipDumpWriteBlobStore(dumpName, zipArchiveOutputStream);
        return new ZipDumpWriter(blobStore, new DefaultFilePaths(PathRef.of(dumpName)), zipDumpWriteBlobStore, zipArchiveOutputStream);
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}
Also used : ZipDumpWriteBlobStore(com.enonic.xp.repo.impl.dump.blobstore.ZipDumpWriteBlobStore) ZipArchiveOutputStream(org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream) DefaultFilePaths(com.enonic.xp.repo.impl.dump.DefaultFilePaths) UncheckedIOException(java.io.UncheckedIOException) IOException(java.io.IOException) UncheckedIOException(java.io.UncheckedIOException)

Aggregations

DefaultFilePaths (com.enonic.xp.repo.impl.dump.DefaultFilePaths)1 ZipDumpWriteBlobStore (com.enonic.xp.repo.impl.dump.blobstore.ZipDumpWriteBlobStore)1 IOException (java.io.IOException)1 UncheckedIOException (java.io.UncheckedIOException)1 ZipArchiveOutputStream (org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream)1