public class ArchiveTools extends Object
| Constructor and Description |
|---|
ArchiveTools() |
| Modifier and Type | Method and Description |
|---|---|
static String |
archive(File root,
String relativePath,
File file,
int max,
String sourceEncoding,
String destinationEncoding,
boolean deleteSource,
boolean forceArchive)
Archive a files content.
|
static String |
archive(File root,
String relativePath,
String filename,
InputStream is,
int max)
Create a archive file and dump the input stream to this file.
|
static File |
createArchive(File root,
String relativePath,
String filename,
int max)
Just creates a archive file, nothing will be dumped inside this file.
|
static OutputStream |
createOutputStream(File root,
String filename,
int max) |
public static String archive(File root, String relativePath, File file, int max, String sourceEncoding, String destinationEncoding, boolean deleteSource, boolean forceArchive) throws 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.IOExceptionpublic static String archive(File root, String relativePath, String filename, InputStream is, int max) throws 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.IOExceptionpublic static File createArchive(File root, String relativePath, String filename, int max) throws 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.hanIOExceptionpublic static OutputStream createOutputStream(File root, String filename, int max) throws IOException
IOExceptionCopyright © 2013 intarsys consulting GmbH. All Rights Reserved.