|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.janrufmonitor.repository.zip.ZipArchive
public class ZipArchive
This class is an implementation of a ZIP archive, which is used for several storage activities in jAnrufmonitor. It simple creates a new archive or open an existing one by the specified path.
| Field Summary | |
|---|---|
static String |
VERSION_ENTRY
Version String which is stored as dummy entry in the zip as a signature. |
| Constructor Summary | |
|---|---|
ZipArchive(File archive,
boolean useLock)
Constructor with a File reference to a zip archive. |
|
ZipArchive(String archive)
Constructor with a path to a zip archive. |
|
ZipArchive(String archive,
boolean useLock)
Constructor with a path to a zip archive. |
|
| Method Summary | |
|---|---|
void |
add(Map m)
Adds multiple entries to the zip archive. |
void |
add(String[] entries,
InputStream[] contents)
Adds multiple entries to the zip archive. |
void |
add(String entry,
InputStream content)
Adds a single new entry. |
boolean |
available()
Checks if the archive is already opened. |
void |
backup()
Backs up the content of the archive to a ~ file. |
void |
close()
Closes the archive. |
boolean |
existEntry(String entry)
Checks wether an extry exists or not |
InputStream |
get(String entry)
Gets a single entry's InputStream by its entryname. |
byte[] |
getContent(String entry)
Gets the content as byte array for a single entryname |
boolean |
isCorrupted()
Checks the consistency of the ZipArchive and returns true if the archive is not consistent. |
boolean |
isCreatedByCurrentVersion()
Return wether this archive was created by the current program version. |
List |
list()
Returns a list of all entrynames in this archive. |
List |
list(FilenameFilter filter)
Returns a list of all entrynames in this archive, filtered by a FilenameFilter object. |
void |
open()
Opens the existing archive or creates a new onw if archive does not exist. |
void |
remove(List entries)
Removes multiple entries as a List with Strings. |
void |
remove(String entry)
Removes a single entry. |
void |
remove(String[] entries)
Removes multiple entries. |
void |
restore()
Restores a backed up file with ~ extension. |
int |
size()
Returns the number of entries stored in the archive. |
File |
toFile()
Returns the ZipArchive as a java.io.File representation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static String VERSION_ENTRY
| Constructor Detail |
|---|
public ZipArchive(String archive)
archive -
public ZipArchive(String archive,
boolean useLock)
archive - useLock - lock the archive during usage
public ZipArchive(File archive,
boolean useLock)
archive - useLock - lock the archive during usage| Method Detail |
|---|
public void open()
throws ZipArchiveException
ZipArchiveExceptionpublic boolean isCorrupted()
public void close()
throws ZipArchiveException
ZipArchiveExceptionpublic boolean available()
public int size()
throws ZipArchiveException
ZipArchiveException
public void add(String entry,
InputStream content)
throws ZipArchiveException
entry - specifies the path in the Zipcontent - content object as InputStream
ZipArchiveException
public void add(String[] entries,
InputStream[] contents)
throws ZipArchiveException
entries - array of entry stringscontents - array of InputStreams with content
ZipArchiveException
public void add(Map m)
throws ZipArchiveException
m - Map of contents. Key of map must be a String and is used as zip entry name
ZipArchiveException
public boolean existEntry(String entry)
throws ZipArchiveException
entry - entry to check
ZipArchiveException
public InputStream get(String entry)
throws ZipArchiveException
entry -
ZipArchiveException
public byte[] getContent(String entry)
throws ZipArchiveException
entry -
ZipArchiveExceptionpublic File toFile()
public boolean isCreatedByCurrentVersion()
throws ZipArchiveException
ZipArchiveException
public List list()
throws ZipArchiveException
ZipArchiveException
public List list(FilenameFilter filter)
throws ZipArchiveException
filter -
ZipArchiveException
public void remove(String entry)
throws ZipArchiveException
entry -
ZipArchiveException
public void remove(String[] entries)
throws ZipArchiveException
entries -
ZipArchiveException
public void remove(List entries)
throws ZipArchiveException
entries -
ZipArchiveException
public void restore()
throws ZipArchiveException
ZipArchiveException
public void backup()
throws ZipArchiveException
ZipArchiveException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||