public class JarFileSystem extends AbstractFileSystem
For historical reasons many AbstractFileSystem.* methods are implemented as protected in this class. Do not call them! Subclasses might override them, or (better) use delegation.
Most module code should never create an instance of this class directly.
Use FileUtil.getArchiveRoot(FileObject) instead.
| Modifier and Type | Class | Description |
|---|---|---|
static class |
JarFileSystem.Impl |
Implementation of all interfaces List, Change, Info and Attr
that delegates to JarFileSystem
|
AbstractFileSystem.Attr, AbstractFileSystem.Change, AbstractFileSystem.Info, AbstractFileSystem.List, AbstractFileSystem.SymlinkInfo, AbstractFileSystem.TransferFileSystem.AtomicActionattr, change, info, list, transferPROP_DISPLAY_NAME, PROP_HIDDEN, PROP_READ_ONLY, PROP_ROOT, PROP_SYSTEM_NAME, PROP_VALID| Constructor | Description |
|---|---|
JarFileSystem() |
Default constructor.
|
JarFileSystem(java.io.File jar) |
Creates new JAR for a given JAR file.
|
| Modifier and Type | Method | Description |
|---|---|---|
protected java.util.Enumeration<java.lang.String> |
attributes(java.lang.String name) |
|
protected java.lang.String[] |
children(java.lang.String name) |
|
protected void |
createData(java.lang.String name) |
|
protected void |
createFolder(java.lang.String name) |
|
protected <T extends FileObject> |
createReference(T fo) |
Creates Reference.
|
protected void |
delete(java.lang.String name) |
|
protected void |
deleteAttributes(java.lang.String name) |
|
protected void |
finalize() |
Close the jar file when we go away...
|
protected boolean |
folder(java.lang.String name) |
|
java.lang.String |
getDisplayName() |
Provides a name for the system that can be presented to the user.
|
java.io.File |
getJarFile() |
Get the file path for the ZIP or JAR file.
|
java.util.jar.Manifest |
getManifest() |
Get the JAR manifest.
|
protected java.io.InputStream |
inputStream(java.lang.String name) |
|
boolean |
isReadOnly() |
This filesystem is read-only.
|
protected java.util.Date |
lastModified(java.lang.String name) |
|
protected void |
lock(java.lang.String name) |
|
protected void |
markUnimportant(java.lang.String name) |
|
protected java.lang.String |
mimeType(java.lang.String name) |
|
protected java.io.OutputStream |
outputStream(java.lang.String name) |
|
protected java.lang.Object |
readAttribute(java.lang.String name,
java.lang.String attrName) |
|
protected boolean |
readOnly(java.lang.String name) |
|
void |
removeNotify() |
Notifies this filesystem that it has been removed from the repository.
|
protected void |
rename(java.lang.String oldName,
java.lang.String newName) |
|
protected void |
renameAttributes(java.lang.String oldName,
java.lang.String newName) |
|
void |
setJarFile(java.io.File aRoot) |
Set name of the ZIP/JAR file.
|
protected long |
size(java.lang.String name) |
|
protected void |
unlock(java.lang.String name) |
|
protected void |
writeAttribute(java.lang.String name,
java.lang.String attrName,
java.lang.Object value) |
canRead, canWrite, checkVirtual, existingFileObjects, findReference, findResource, getRefreshTime, getRoot, markImportant, refresh, refreshResource, refreshRoot, setRefreshTimeaddFileChangeListener, addFileStatusListener, addNotify, addPropertyChangeListener, addVetoableChangeListener, createTempFile, find, findExtrasFor, fireFileStatusChanged, firePropertyChange, fireVetoableChange, getDecorator, getSystemName, getTempFolder, isDefault, isValid, removeFileChangeListener, removeFileStatusListener, removePropertyChangeListener, removeVetoableChangeListener, runAtomicAction, setSystemName, toStringpublic JarFileSystem()
Most module code should never create an instance of this class directly.
Use FileUtil.getArchiveRoot(FileObject) instead.
public JarFileSystem(java.io.File jar)
throws java.io.IOException
JarFileSystem fs = new JarFileSystem(); fs.setJarFile(jar);but it is more effective in some situations. It does not open and read the content of the jar file immediately. Instead it waits until somebody asks for resources from inside the JAR.
jar - location of the JAR filejava.io.IOExceptionprotected <T extends FileObject> java.lang.ref.Reference<T> createReference(T fo)
AbstractFileSystemcreateReference in class AbstractFileSystemfo - is FileObject. It`s reference yourequire to get.public java.util.jar.Manifest getManifest()
public void setJarFile(java.io.File aRoot)
throws java.io.IOException,
java.beans.PropertyVetoException
aRoot - path to new ZIP or JAR filejava.io.IOException - if the file is not validjava.lang.IllegalArgumentException - if the file is not normalizedjava.beans.PropertyVetoExceptionpublic java.io.File getJarFile()
public java.lang.String getDisplayName()
FileSystem
This call should never be used to attempt to identify the file root
of the filesystem. On some systems it may happen to look the same but this is a
coincidence and may well change in the future. Either check whether
you are working with a LocalFileSystem or similar implementation and use
LocalFileSystem.getRootDirectory(); or better, try
FileUtil.toFile(org.openide.filesystems.FileObject) which is designed to do this correctly.
Note: for most purposes it is probably a bad idea to use
this method. Instead look at FileUtil.getFileDisplayName(org.openide.filesystems.FileObject).
getDisplayName in class AbstractFileSystempublic boolean isReadOnly()
isReadOnly in class FileSystemtruepublic void removeNotify()
FileSystemNote that this method is advisory and serves as an optimization to avoid retaining resources for too long etc. Filesystems should maintain correct semantics regardless of whether and when this method is called.
removeNotify in class FileSystemprotected java.lang.String[] children(java.lang.String name)
protected void createFolder(java.lang.String name)
throws java.io.IOException
java.io.IOExceptionprotected void createData(java.lang.String name)
throws java.io.IOException
java.io.IOExceptionprotected void rename(java.lang.String oldName,
java.lang.String newName)
throws java.io.IOException
java.io.IOExceptionprotected void delete(java.lang.String name)
throws java.io.IOException
java.io.IOExceptionprotected java.util.Date lastModified(java.lang.String name)
protected boolean folder(java.lang.String name)
protected boolean readOnly(java.lang.String name)
protected java.lang.String mimeType(java.lang.String name)
protected long size(java.lang.String name)
protected java.io.InputStream inputStream(java.lang.String name)
throws java.io.FileNotFoundException
java.io.FileNotFoundExceptionprotected java.io.OutputStream outputStream(java.lang.String name)
throws java.io.IOException
java.io.IOExceptionprotected void lock(java.lang.String name)
throws java.io.IOException
java.io.IOExceptionprotected void unlock(java.lang.String name)
protected void markUnimportant(java.lang.String name)
protected java.lang.Object readAttribute(java.lang.String name,
java.lang.String attrName)
protected void writeAttribute(java.lang.String name,
java.lang.String attrName,
java.lang.Object value)
throws java.io.IOException
java.io.IOExceptionprotected java.util.Enumeration<java.lang.String> attributes(java.lang.String name)
protected void renameAttributes(java.lang.String oldName,
java.lang.String newName)
protected void deleteAttributes(java.lang.String name)
protected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.ThrowableBuilt on April 24 2018. | Portions Copyright 1997-2018 Oracle. All rights reserved.