org.openide.filesystems
Class JarFileSystem

java.lang.Object
  |
  +--org.openide.filesystems.FileSystem
        |
        +--org.openide.filesystems.AbstractFileSystem
              |
              +--org.openide.filesystems.JarFileSystem
All Implemented Interfaces:
Serializable

public class JarFileSystem
extends AbstractFileSystem

A virtual file system based on a JAR archive.

See Also:
Serialized Form

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()
          Notifies this file system that it has been added to the repository.
protected  Enumeration attributes(String name)
           
protected  String[] children(String name)
           
protected  void createData(String name)
           
protected  void createFolder(String name)
           
protected  Reference createReference(FileObject fo)
          Creates Reference.
protected  void delete(String name)
           
protected  void deleteAttributes(String name)
           
protected  void finalize()
          Close the jar file when we go away...
protected  boolean folder(String name)
           
 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.
protected  InputStream inputStream(String name)
           
 boolean isReadOnly()
          This file system is read-only.
protected  Date lastModified(String name)
           
protected  void lock(String name)
           
protected  void markUnimportant(String name)
           
protected  String mimeType(String name)
           
protected  OutputStream outputStream(String name)
           
 void prepareEnvironment(FileSystem.Environment env)
          Prepare environment for external compilation or execution.
protected  Object readAttribute(String name, String attrName)
           
protected  boolean readOnly(String name)
           
 void removeNotify()
          Notifies this file system that it has been removed from the repository.
protected  void rename(String oldName, String newName)
           
protected  void renameAttributes(String oldName, String newName)
           
 void setJarFile(File aRoot)
          Set name of the ZIP/JAR file.
protected  long size(String name)
           
protected  void unlock(String name)
           
protected  void writeAttribute(String name, String attrName, Object value)
           
 
Methods inherited from class org.openide.filesystems.AbstractFileSystem
checkVirtual, existingFileObjects, find, findReference, findResource, getActions, getRefreshTime, getRoot, markImportant, 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

JarFileSystem

public JarFileSystem()
Default constructor.

JarFileSystem

public JarFileSystem(FileSystemCapability cap)
Constructor that can provide own capability for the file system.
Parameters:
cap - the capability
Method Detail

createReference

protected Reference createReference(FileObject fo)
Description copied from class: AbstractFileSystem
Creates Reference. In FileSystem, which subclasses AbstractFileSystem, you can overload method createReference(FileObject fo) to achieve another type of Reference (weak, strong etc.)
Overrides:
createReference in class AbstractFileSystem
Following copied from class: org.openide.filesystems.AbstractFileSystem
Parameters:
fo - is FileObject. It`s reference yourequire to get.
Returns:
Reference to FileObject

getManifest

public Manifest getManifest()
Get the JAR manifest. It will be lazily initialized.
Returns:
parsed manifest file for this archive

setJarFile

public void setJarFile(File aRoot)
                throws IOException,
                       PropertyVetoException
Set name of the ZIP/JAR file.
Parameters:
aRoot - path to new ZIP or JAR file
Throws:
IOException - if the file is not valid

getJarFile

public File getJarFile()
Get the file path for the ZIP or JAR file.
Returns:
the file path

getDisplayName

public String getDisplayName()
Description copied from class: FileSystem
Provides a name for the system that can be presented to the user.

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.

Overrides:
getDisplayName in class AbstractFileSystem
Following copied from class: org.openide.filesystems.FileSystem
Returns:
user presentable name of the file system

isReadOnly

public boolean isReadOnly()
This file system is read-only.
Overrides:
isReadOnly in class FileSystem
Returns:
true

removeNotify

public void removeNotify()
Description copied from class: FileSystem
Notifies this file system that it has been removed from the repository. Concrete file system implementations could perform clean-up here. The default implementation does nothing.

Note 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.

Overrides:
removeNotify in class FileSystem

addNotify

public void addNotify()
Description copied from class: FileSystem
Notifies this file system that it has been added to the repository. Various initialization tasks could go here. The default implementation does nothing.

Note 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.

Overrides:
addNotify in class FileSystem

prepareEnvironment

public void prepareEnvironment(FileSystem.Environment env)
Prepare environment for external compilation or execution.

Adds name of the ZIP/JAR file, if it has been set, to the class path.

Overrides:
prepareEnvironment in class FileSystem
Following copied from class: org.openide.filesystems.FileSystem
Parameters:
env - the environment to setup
Throws:
EnvironmentNotSupportedException - if external execution and compilation cannot be supported

children

protected String[] children(String name)

createFolder

protected void createFolder(String name)
                     throws IOException

createData

protected void createData(String name)
                   throws IOException

rename

protected void rename(String oldName,
                      String newName)
               throws IOException

delete

protected void delete(String name)
               throws IOException

lastModified

protected Date lastModified(String name)

folder

protected boolean folder(String name)

readOnly

protected boolean readOnly(String name)

mimeType

protected String mimeType(String name)

size

protected long size(String name)

inputStream

protected InputStream inputStream(String name)
                           throws FileNotFoundException

outputStream

protected OutputStream outputStream(String name)
                             throws IOException

lock

protected void lock(String name)
             throws IOException

unlock

protected void unlock(String name)

markUnimportant

protected void markUnimportant(String name)

readAttribute

protected Object readAttribute(String name,
                               String attrName)

writeAttribute

protected void writeAttribute(String name,
                              String attrName,
                              Object value)
                       throws IOException

attributes

protected Enumeration attributes(String name)

renameAttributes

protected void renameAttributes(String oldName,
                                String newName)

deleteAttributes

protected void deleteAttributes(String name)

finalize

protected void finalize()
                 throws Throwable
Close the jar file when we go away...
Overrides:
finalize in class Object


Built on December 12 2001.  |  Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.