Class JarExporter
- java.lang.Object
-
- org.apache.jackrabbit.vault.fs.io.AbstractExporter
-
- org.apache.jackrabbit.vault.fs.io.JarExporter
-
- All Implemented Interfaces:
AutoCloseable
public class JarExporter extends AbstractExporter
Implements a Vault filesystem exporter that exports Vault files to a jar file. The entries are stored compressed in the jar (asZipEntry
zip entries.The exporter can optimize the export throughput for binaries, by avoiding to compress incompressible binaries. The optimization is enabled for all
Deflater
compression levels butDeflater.DEFAULT_COMPRESSION
,Deflater.NO_COMPRESSION
andDeflater.BEST_COMPRESSION
.The exporter uses the
PlatformNameFormat
for formatting the jcr file names to local ones.
-
-
Field Summary
-
Fields inherited from class org.apache.jackrabbit.vault.fs.io.AbstractExporter
exportInfo
-
-
Constructor Summary
Constructors Constructor Description JarExporter(File jarFile)
Constructs a new jar exporter that writes to the given file.JarExporter(File jarFile, int level)
Constructs a new jar exporter that writes to the given file.JarExporter(OutputStream out)
Constructs a new jar exporter that writes to the output stream.JarExporter(OutputStream out, int level)
Constructs a new jar exporter that writes to the output stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes the exporter and releases the undelying structures.void
createDirectory(String relPath)
void
createDirectory(VaultFile file, String relPath)
void
open()
Opens the exporter and initializes the undelying structures.void
write(ZipFile zip, ZipEntry entry)
void
writeFile(InputStream in, String relPath)
The specified stream is automatically closed after this method returns or throws an exception.void
writeFile(VaultFile file, String relPath)
-
Methods inherited from class org.apache.jackrabbit.vault.fs.io.AbstractExporter
export, export, export, getExportInfo, getGenerator, getPlatformFilePath, getRootPath, isNoMetaInf, isRelativePaths, isVerbose, setGenerator, setNoMetaInf, setProperties, setProperty, setProperty, setRelativePaths, setRootPath, setVerbose, track, track
-
-
-
-
Constructor Detail
-
JarExporter
public JarExporter(File jarFile)
Constructs a new jar exporter that writes to the given file.- Parameters:
jarFile
- the jar file
-
JarExporter
public JarExporter(File jarFile, int level)
Constructs a new jar exporter that writes to the given file.- Parameters:
jarFile
- the jar filelevel
- level the compression level
-
JarExporter
public JarExporter(OutputStream out)
Constructs a new jar exporter that writes to the output stream. The given output stream is closed when callingclose()
.- Parameters:
out
- the output stream
-
JarExporter
public JarExporter(OutputStream out, int level)
Constructs a new jar exporter that writes to the output stream. The given output stream is closed when callingclose()
.- Parameters:
out
- the output streamlevel
- level the compression level
-
-
Method Detail
-
open
public void open() throws IOException
Opens the exporter and initializes the undelying structures.- Specified by:
open
in classAbstractExporter
- Throws:
IOException
- if an I/O error occurs
-
close
public void close() throws IOException
Description copied from class:AbstractExporter
Closes the exporter and releases the undelying structures.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in classAbstractExporter
- Throws:
IOException
- if an I/O error occurs
-
createDirectory
public void createDirectory(VaultFile file, String relPath) throws RepositoryException, IOException
- Specified by:
createDirectory
in classAbstractExporter
- Throws:
RepositoryException
IOException
-
createDirectory
public void createDirectory(String relPath) throws IOException
- Specified by:
createDirectory
in classAbstractExporter
- Throws:
IOException
-
writeFile
public void writeFile(VaultFile file, String relPath) throws RepositoryException, IOException
- Specified by:
writeFile
in classAbstractExporter
- Throws:
RepositoryException
IOException
-
writeFile
public void writeFile(InputStream in, String relPath) throws IOException
Description copied from class:AbstractExporter
The specified stream is automatically closed after this method returns or throws an exception.
- Specified by:
writeFile
in classAbstractExporter
- Throws:
IOException
-
write
public void write(ZipFile zip, ZipEntry entry) throws IOException
- Throws:
IOException
-
-