public class ArchiveTools
extends java.lang.Object
Constructor and Description |
---|
ArchiveTools() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
archive(java.io.File root,
java.lang.String relativePath,
java.io.File file,
int max,
java.lang.String sourceEncoding,
java.lang.String destinationEncoding,
boolean deleteSource,
boolean forceArchive)
Archive a files content.
|
static java.lang.String |
archive(java.io.File root,
java.lang.String relativePath,
java.lang.String filename,
java.io.InputStream is,
int max)
Create a archive file and dump the input stream to this file.
|
static java.io.File |
createArchive(java.io.File root,
java.lang.String relativePath,
java.lang.String filename,
int max)
Just creates a archive file, nothing will be dumped inside this file.
|
static java.io.OutputStream |
createOutputStream(java.io.File root,
java.lang.String filename,
int max) |
public static java.lang.String archive(java.io.File root, java.lang.String relativePath, java.io.File file, int max, java.lang.String sourceEncoding, java.lang.String destinationEncoding, boolean deleteSource, boolean forceArchive) throws java.io.IOException
The method creates a copy in the archive directory with a unique name
that is guaranteed to create a sortable representation so that newer
files have a "greater" filename. Creation of file names is thread safe.
If more than max
files are in the archive directory, the
oldest files are deleted. max = 0 means never create archive, max = -1
means always create archive. If deleteSource
is
true
, the file to be archived is deleted after the archive
was created.
root
- The root for relative addressing.relativePath
- The path relative to root where to create the archive.file
- The file to archive.max
- The maximum number of archive files allowed.hansourceEncoding
- The encoding of the file to be archived.destinationEncoding
- The encoding of the archived file.deleteSource
- Flag if source should be deleted.forceArchive
- Flag if we should archive even if file is already in the
archive directory.java.io.IOException
public static java.lang.String archive(java.io.File root, java.lang.String relativePath, java.lang.String filename, java.io.InputStream is, int max) throws java.io.IOException
root
- The root for relative addressing.relativePath
- The path relative to root where to create the archive.filename
- The file to archive.max
- The maximum number of archive files allowed.hanis
- The input stream to be dumped.java.io.IOException
public static java.io.File createArchive(java.io.File root, java.lang.String relativePath, java.lang.String filename, int max) throws java.io.IOException
root
- The root for relative addressing.relativePath
- The path relative to root where to create the archive.filename
- The file to archive.max
- The maximum number of archive files allowed.hanjava.io.IOException
public static java.io.OutputStream createOutputStream(java.io.File root, java.lang.String filename, int max) throws java.io.IOException
java.io.IOException