|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.openide.filesystems.FileSystem | +--org.openide.filesystems.AbstractFileSystem | +--org.openide.filesystems.JarFileSystem
A virtual file system based on a JAR archive.
Inner Class Summary | |
static class |
JarFileSystem.Impl
Implementation of all interfaces List, Change, Info and Attr that delegates to JarFileSystem |
Inner classes inherited from class org.openide.filesystems.AbstractFileSystem |
AbstractFileSystem.Attr, AbstractFileSystem.Change, AbstractFileSystem.Info, AbstractFileSystem.List, AbstractFileSystem.Transfer |
Inner classes inherited from class org.openide.filesystems.FileSystem |
FileSystem.AtomicAction, FileSystem.Environment, FileSystem.Status |
Fields inherited from class org.openide.filesystems.AbstractFileSystem |
attr, change, info, list, transfer |
Fields inherited from class org.openide.filesystems.FileSystem |
PROP_HIDDEN, PROP_READ_ONLY, PROP_ROOT, PROP_SYSTEM_NAME, PROP_VALID |
Constructor Summary | |
JarFileSystem()
Default constructor. |
|
JarFileSystem(FileSystemCapability cap)
Constructor that can provide own capability for the file system. |
Method Summary | |
void |
addNotify()
initialization of jar variable, that is necessary after JarFileSystem was removed from Repository |
protected Enumeration |
attributes(String name)
Get all file attribute names for the file. |
protected String[] |
children(String name)
Scans children for given name |
protected void |
createData(String name)
Create new data file. |
protected void |
createFolder(String name)
Creates new folder named name. |
protected Reference |
createReference(FileObject fo)
Creates Reference. |
protected void |
delete(String name)
Delete the file. |
protected void |
deleteAttributes(String name)
Called when a file is deleted to also delete its attributes. |
protected void |
finalize()
Close the jar file when we go away... |
FileObject |
find(String aPackage,
String name,
String ext)
Finds file in the filesystem by name. |
FileObject |
findResource(String name)
Finds file when its resource name is given. |
protected boolean |
folder(String name)
Test if the file is folder or contains data. |
String |
getDisplayName()
Provides a name for the system that can be presented to the user. |
File |
getJarFile()
Get the file path for the ZIP or JAR file. |
Manifest |
getManifest()
Get the JAR manifest. |
FileObject |
getRoot()
Getter for root folder in the filesystem. |
protected InputStream |
inputStream(String name)
Get input stream. |
boolean |
isReadOnly()
This file system is read-only. |
protected Date |
lastModified(String name)
Get last modification time. |
protected void |
lock(String name)
Does nothing. |
protected void |
markUnimportant(String name)
Does nothing. |
protected String |
mimeType(String name)
Get the MIME type of the file. |
protected OutputStream |
outputStream(String name)
Get output stream. |
void |
prepareEnvironment(FileSystem.Environment env)
Prepare environment for external compilation or execution. |
protected Object |
readAttribute(String name,
String attrName)
Get the file attribute with the specified name. |
protected boolean |
readOnly(String name)
Test whether this file can be written to or not. |
void |
removeNotify()
Closes associated JAR file on cleanup, if possible. |
protected void |
rename(String oldName,
String newName)
Renames a file. |
protected void |
renameAttributes(String oldName,
String newName)
Called when a file is renamed, to appropriatelly update its attributes. |
void |
setJarFile(File aRoot)
Set name of the ZIP/JAR file. |
protected long |
size(String name)
Get the size of the file. |
protected void |
unlock(String name)
Unlock the file. |
protected void |
writeAttribute(String name,
String attrName,
Object value)
Set the file attribute with the specified name. |
Methods inherited from class org.openide.filesystems.AbstractFileSystem |
existingFileObjects, findReference, getActions, getRefreshTime, refreshResource, refreshRoot, setRefreshTime |
Methods inherited from class org.openide.filesystems.FileSystem |
addFileStatusListener, addPropertyChangeListener, addVetoableChangeListener, fireFileStatusChanged, firePropertyChange, fireVetoableChange, getActions, getCapability, getStatus, getSystemName, isDefault, isHidden, isPersistent, isValid, removeFileStatusListener, removePropertyChangeListener, removeVetoableChangeListener, runAtomicAction, setCapability, setHidden, setSystemName, toString |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public JarFileSystem()
public JarFileSystem(FileSystemCapability cap)
cap
- the capabilityMethod Detail |
public FileObject getRoot()
getRoot
in class AbstractFileSystem
public FileObject findResource(String name)
FileSystem
ClassLoader.getResource(String)
method. So it may consist of "package1/package2/filename.ext".
If there is no package, it may consist only of "filename.ext".findResource
in class AbstractFileSystem
org.openide.filesystems.FileSystem
name
- resource namenull
if the file does not existpublic FileObject find(String aPackage, String name, String ext)
FileSystem
The default implementation converts dots in the package name into slashes,
concatenates the strings, adds any extension prefixed by a dot and calls
the findResource
method.
Note: when both of name
and ext
are null
then name and
extension should be ignored and scan should look only for a package.
find
in class AbstractFileSystem
org.openide.filesystems.FileSystem
aPackage
- package name where each package component is separated by a dotname
- name of the file (without dots) or null
if
one wants to obtain a folder (package) and not a file in itext
- extension of the file (without leading dot) or null
if one needs
a package and not a filenull
if the file does not existprotected Reference createReference(FileObject fo)
createReference
in class AbstractFileSystem
fo
- is FileObject. It`s reference yourequire to get.public Manifest getManifest()
public void setJarFile(File aRoot) throws IOException, PropertyVetoException
aRoot
- path to new ZIP or JAR fileIOException
- if the file is not validpublic File getJarFile()
public String getDisplayName()
FileSystem
getDisplayName
in class AbstractFileSystem
org.openide.filesystems.FileSystem
public boolean isReadOnly()
isReadOnly
in class FileSystem
true
public void removeNotify()
removeNotify
in class FileSystem
public void addNotify()
addNotify
in class FileSystem
public void prepareEnvironment(FileSystem.Environment env)
Adds name of the ZIP/JAR file, if it has been set, to the class path.
prepareEnvironment
in class FileSystem
org.openide.filesystems.FileSystem
env
- the environment to setupEnvironmentNotSupportedException
- if external execution
and compilation cannot be supportedprotected String[] children(String name)
protected void createFolder(String name) throws IOException
name
- name of folderIOException
- if operation failsprotected void createData(String name) throws IOException
name
- name of the fileIOException
- if the file cannot be created (e.g. already exists)protected void rename(String oldName, String newName) throws IOException
oldName
- old name of the filenewName
- new name of the fileprotected void delete(String name) throws IOException
name
- name of fileIOException
- if the file could not be deletedprotected Date lastModified(String name)
name
- the file to testprotected boolean folder(String name)
name
- name of the fileprotected boolean readOnly(String name)
name
- the file to testtrue
if file is read-onlyprotected String mimeType(String name)
name
- the file to test"text/plain"
)
or null if no special support for recognizing MIME is implemented.protected long size(String name)
name
- the file to testprotected InputStream inputStream(String name) throws FileNotFoundException
name
- the file to testFileNotFoundException
- if the file does not exists or is invalidprotected OutputStream outputStream(String name) throws IOException
name
- the file to testIOException
- if an error occures (the file is invalid, etc.)protected void lock(String name) throws IOException
name
- name of the fileprotected void unlock(String name)
name
- name of the fileprotected void markUnimportant(String name)
name
- the file to markprotected Object readAttribute(String name, String attrName)
name
- the fileattrName
- name of the attributenull
if the attribute is unset (or could not be properly restored for some reason)protected void writeAttribute(String name, String attrName, Object value) throws IOException
name
- the fileattrName
- name of the attributevalue
- new value or null
to clear the attribute. Must be serializable, although particular file systems may or may not use serialization to store attribute values.IOException
- if the attribute cannot be set. If serialization is used to store it, this may in fact be a subclass such as NotSerializableException
.protected Enumeration attributes(String name)
name
- the fileprotected void renameAttributes(String oldName, String newName)
oldName
- old name of the filenewName
- new name of the fileprotected void deleteAttributes(String name)
name
- name of the fileprotected void finalize() throws Throwable
finalize
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |