org.w3c.jigsaw.zip
Class ZipFileResource
java.lang.Object
org.w3c.tools.resources.AttributeHolder
org.w3c.tools.resources.Resource
org.w3c.tools.resources.FramedResource
org.w3c.tools.resources.FileResource
org.w3c.jigsaw.zip.ZipFileResource
- All Implemented Interfaces:
- java.lang.Cloneable, java.util.EventListener, FrameEventListener
public class ZipFileResource
- extends FileResource
Field Summary |
protected static int |
ATTR_ENTRYPATH
Attribute index - The index for our entry path. |
protected static int |
ATTR_ZIPFILE
Attributes index - The filename attribute. |
Method Summary |
java.lang.String |
getEntryPath()
|
protected long |
getEntrySize()
|
java.io.File |
getFile()
Get this zip file. |
protected java.io.InputStream |
getInputStream()
|
protected boolean |
hasEntry()
|
boolean |
newContent(java.io.InputStream in)
Save the given stream as the underlying file content. |
void |
updateFileAttributes()
Update the file related attributes. |
boolean |
verify()
Is that resource still wrapping an existing file ?
If the underlying file has disappeared and if the
container directory is extensible, remove the resource. |
Methods inherited from class org.w3c.tools.resources.FramedResource |
addAttributeChangedListener, addStructureChangedListener, collectFramesReference, delete, disableEvent, displayEvent, enableEvent, eventDisabled, fireAttributeChangeEvent, fireStructureChangedEvent, fireStructureChangedEvent, frameAdded, frameModified, frameRemoved, getClone, getFrame, getFrame, getFrameReference, getFrameReference, getFramesReference, getOid, lookup, markModified, notifyUnload, perform, performFrames, postAttributeChangeEvent, postEvent, postStructureChangedEvent, postStructureChangedEvent, processEvent, registerFrame, registerFrameIfNone, removeAttributeChangedListener, removeStructureChangedListener, setSilentValue, setSilentValue, unregisterFrame |
Methods inherited from class org.w3c.tools.resources.Resource |
acceptUnload, checkMultipleLock, collectFrames, getContext, getFrame, getFrames, getHelpURL, getHelpURL, getIdentifier, getLastModified, getParent, getResourceReference, getServer, getSpace, getSpaceEntry, getStoreEntry, getURLPath, getValue, getValue, initialize, isInitialized, isUnloaded, pickleValues, setContext, setContext, setValue, unsafeGetContext, unsafeGetFrame, unsafeGetFrames, unsafeGetIdentifier, unsafeGetResourceReference, unsafeGetURLPath, unsafeGetValue |
Methods inherited from class org.w3c.tools.resources.AttributeHolder |
definesAttribute, definesAttribute, getAttributes, getBoolean, getChar, getClone, getClone, getDouble, getFloat, getInt, getLong, getString, getValue, lookupAttribute, print, setBoolean, setChar, setDouble, setFloat, setInt, setLong, setString, setValue, unsafeDefinesAttribute, unsafeGetDouble, unsafeGetString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ATTR_ZIPFILE
protected static int ATTR_ZIPFILE
- Attributes index - The filename attribute.
ATTR_ENTRYPATH
protected static int ATTR_ENTRYPATH
- Attribute index - The index for our entry path.
ZipFileResource
public ZipFileResource()
getFile
public java.io.File getFile()
- Get this zip file.
- Overrides:
getFile
in class FileResource
- Returns:
- a File instance.
getEntryPath
public java.lang.String getEntryPath()
getInputStream
protected java.io.InputStream getInputStream()
getEntrySize
protected long getEntrySize()
hasEntry
protected boolean hasEntry()
updateFileAttributes
public void updateFileAttributes()
- Update the file related attributes.
The file we serve has changed since the last time we checked it, if
any of the attribute values depend on the file content, this is the
appropriate place to recompute them.
- Overrides:
updateFileAttributes
in class FileResource
verify
public boolean verify()
- Is that resource still wrapping an existing file ?
If the underlying file has disappeared and if the
container directory is extensible, remove the resource.
- Overrides:
verify
in class FileResource
- Returns:
- A boolean.
newContent
public boolean newContent(java.io.InputStream in)
throws java.io.IOException
- Save the given stream as the underlying file content.
This method preserve the old file version in a
~
file.
- Overrides:
newContent
in class FileResource
- Parameters:
in
- The input stream to use as the resource entity.
- Returns:
- A boolean, true if the resource was just
created, false otherwise.
- Throws:
java.io.IOException
- If dumping the content failed.