|
TrueZIP 6.8.3 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectde.schlichtherle.io.archive.spi.AbstractArchiveDriver
public abstract class AbstractArchiveDriver
An abstract archive driver implementation to ease the task of developing an archive driver. It provides default implementations for character sets and icon handling.
Since TrueZIP 6.4, this class is serializable in order to meet the
requirements of the File class.
| Nested Class Summary | |
|---|---|
protected static class |
AbstractArchiveDriver.InconsistentCharsetSupportError
Thrown to indicate that the character set implementation in the Java Runtime Environment (JRE) for the Java Standard Edition (JSE) is broken and needs fixing. |
private class |
AbstractArchiveDriver.ThreadLocalEncoder
|
| Field Summary | |
|---|---|
private String |
charset
|
private static String |
CLASS_NAME
|
private Icon |
closedIcon
|
private AbstractArchiveDriver.ThreadLocalEncoder |
encoder
This field should be considered to be final! |
private static Logger |
logger
|
private Icon |
openIcon
|
private static long |
serialVersionUID
|
| Constructor Summary | |
|---|---|
protected |
AbstractArchiveDriver(String charset,
Icon openIcon,
Icon closedIcon)
Constructs a new abstract archive driver. |
| Method Summary | |
|---|---|
protected void |
ensureEncodable(String entryName)
Ensures that the given entry name is representable in this driver's character set charset. |
String |
getCharset()
Returns the value of the property charset which was
provided to the constructor. |
Icon |
getClosedIcon(Archive archive)
Returns the value of the property closedIcon which was
provided to the constructor. |
String |
getEncoding()
Deprecated. Use getCharset() instead. |
Icon |
getOpenIcon(Archive archive)
Returns the value of the property openIcon which was
provided to the constructor. |
private boolean |
invariants()
Checks the invariants of this class and throws an AssertionError if any is violated even if assertion checking is disabled. |
private void |
readObject(ObjectInputStream in)
Postfixes the instance after its default deserialization. |
private static UnsupportedEncodingException |
testJSE11Support(String charset)
|
private static UnsupportedCharsetException |
testJSE14Support(String charset)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface de.schlichtherle.io.archive.spi.ArchiveDriver |
|---|
createArchiveEntry, createInputArchive, createOutputArchive, equals, hashCode |
| Field Detail |
|---|
private static final long serialVersionUID
private static final String CLASS_NAME
private static final Logger logger
private final String charset
private final Icon openIcon
private final Icon closedIcon
private transient AbstractArchiveDriver.ThreadLocalEncoder encoder
final!
ensureEncodable(java.lang.String)| Constructor Detail |
|---|
protected AbstractArchiveDriver(String charset,
Icon openIcon,
Icon closedIcon)
charset - The name of a character set to use by default for all
entry names and probably other meta data when reading or writing
archive files.openIcon - The icon to return by getOpenIcon(de.schlichtherle.io.archive.Archive).
May be null.closedIcon - The icon to return by getClosedIcon(de.schlichtherle.io.archive.Archive).
May be null.
NullPointerException - If charset is
null.
UnsupportedCharsetException - If charset is not
supported by both the JSE 1.1 API and JSE 1.4 API.
AbstractArchiveDriver.InconsistentCharsetSupportError - If charset is
supported by the JSE 1.1 API, but not the JSE 1.4 API,
or vice versa.| Method Detail |
|---|
private static UnsupportedEncodingException testJSE11Support(String charset)
private static UnsupportedCharsetException testJSE14Support(String charset)
private void readObject(ObjectInputStream in)
throws IOException,
ClassNotFoundException
InvalidObjectException - If the instance invariants are not met.
IOException
ClassNotFoundExceptionprivate boolean invariants()
The constructors call this method like this:
assert invariants();
This calls the method if and only if assertions are enabled in order
to assert that the instance invariants are properly obeyed.
If assertions are disabled, the call to this method is thrown away by
the HotSpot compiler, so there is no performance penalty.
When deserializing however, this method is called regardless of the
assertion status. On error, the AssertionError is wrapped
in an InvalidObjectException and thrown instead.
true
AssertionError - If any invariant is violated even if assertions
are disabled.
protected final void ensureEncodable(String entryName)
throws CharConversionException
ArchiveDriver.createArchiveEntry(de.schlichtherle.io.archive.Archive, java.lang.String, de.schlichtherle.io.archive.spi.ArchiveEntry).
entryName - A valid archive entry name - null is not
permissible.
CharConversionException - If the entry name contains characters
which cannot get encoded.getCharset(),
Requirements for Archive Entry Namespublic final String getCharset()
charset which was
provided to the constructor.
public final String getEncoding()
getCharset() instead.
public final Icon getOpenIcon(Archive archive)
openIcon which was
provided to the constructor.
getOpenIcon in interface ArchiveDriverarchive - Ignored.
null is returned, a default icon should be used.public final Icon getClosedIcon(Archive archive)
closedIcon which was
provided to the constructor.
getClosedIcon in interface ArchiveDriverarchive - Ignored.
null is returned, a default icon should be used.
|
TrueZIP 6.8.3 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||