org.openide.filesystems 7.3.1

org.openide.filesystems
Class JarFileSystem.Impl

java.lang.Object
  extended by org.openide.filesystems.JarFileSystem.Impl
All Implemented Interfaces:
Serializable, AbstractFileSystem.Attr, AbstractFileSystem.Change, AbstractFileSystem.Info, AbstractFileSystem.List
Enclosing class:
JarFileSystem

public static class JarFileSystem.Impl
extends Object
implements AbstractFileSystem.List, AbstractFileSystem.Info, AbstractFileSystem.Change, AbstractFileSystem.Attr

Implementation of all interfaces List, Change, Info and Attr that delegates to JarFileSystem

See Also:
Serialized Form

Constructor Summary
JarFileSystem.Impl(JarFileSystem fs)
          Constructor.
 
Method Summary
 Enumeration<String> attributes(String name)
          Get all file attribute names for the file.
 String[] children(String name)
          Get a list of children files for a given folder.
 void createData(String name)
          Create new data file.
 void createFolder(String name)
          Create new folder.
 void delete(String name)
          Delete a file.
 void deleteAttributes(String name)
          Called when a file is deleted, to also delete its attributes.
 boolean folder(String name)
          Test if the file is a folder or contains data.
 InputStream inputStream(String name)
          Get input stream.
 Date lastModified(String name)
          Get last modification time.
 void lock(String name)
          Lock the file.
 void markUnimportant(String name)
          Mark the file as being unimportant.
 String mimeType(String name)
          Get the MIME type of the file.
 OutputStream outputStream(String name)
          Get output stream.
 Object readAttribute(String name, String attrName)
          Get the file attribute with the specified name.
 boolean readOnly(String name)
          Test whether this file can be written to or not.
 void rename(String oldName, String newName)
          Rename a file.
 void renameAttributes(String oldName, String newName)
          Called when a file is renamed, to appropriately update its attributes.
 long size(String name)
          Get the size of the file.
 void unlock(String name)
          Unlock the file.
 void writeAttribute(String name, String attrName, Object value)
          Set the file attribute with the specified name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JarFileSystem.Impl

public JarFileSystem.Impl(JarFileSystem fs)
Constructor.

Parameters:
fs - the filesystem to delegate to
Method Detail

children

public String[] children(String name)
Description copied from interface: AbstractFileSystem.List
Get a list of children files for a given folder.

Specified by:
children in interface AbstractFileSystem.List
Parameters:
name - the folder, by name; e.g. top/next/afterthat
Returns:
a list of children of the folder, as file.ext (no path) the array can contain null values that will be ignored

createFolder

public void createFolder(String name)
                  throws IOException
Description copied from interface: AbstractFileSystem.Change
Create new folder.

Specified by:
createFolder in interface AbstractFileSystem.Change
Parameters:
name - full name of new folder, e.g. topfolder/newfolder
Throws:
IOException - if the operation fails

createData

public void createData(String name)
                throws IOException
Description copied from interface: AbstractFileSystem.Change
Create new data file.

Specified by:
createData in interface AbstractFileSystem.Change
Parameters:
name - full name of the file, e.g. path/from/root/filename.ext
Throws:
IOException - if the file cannot be created (e.g. already exists)

rename

public void rename(String oldName,
                   String newName)
            throws IOException
Description copied from interface: AbstractFileSystem.Change
Rename a file.

Specified by:
rename in interface AbstractFileSystem.Change
Parameters:
oldName - old name of the file; fully qualified
newName - new name of the file; fully qualified
Throws:
IOException - if it could not be renamed

delete

public void delete(String name)
            throws IOException
Description copied from interface: AbstractFileSystem.Change
Delete a file.

Specified by:
delete in interface AbstractFileSystem.Change
Parameters:
name - name of file; fully qualified
Throws:
IOException - if the file could not be deleted

lastModified

public Date lastModified(String name)
Description copied from interface: AbstractFileSystem.Info
Get last modification time.

Specified by:
lastModified in interface AbstractFileSystem.Info
Parameters:
name - the file to test
Returns:
the date of last modification

folder

public boolean folder(String name)
Description copied from interface: AbstractFileSystem.Info
Test if the file is a folder or contains data.

Specified by:
folder in interface AbstractFileSystem.Info
Parameters:
name - name of the file
Returns:
true if the file is folder, false if it is data

readOnly

public boolean readOnly(String name)
Description copied from interface: AbstractFileSystem.Info
Test whether this file can be written to or not.

Specified by:
readOnly in interface AbstractFileSystem.Info
Parameters:
name - the file to test
Returns:
true if the file is read-only

mimeType

public String mimeType(String name)
Description copied from interface: AbstractFileSystem.Info
Get the MIME type of the file. If filesystem has no special support for MIME types then can simply return null. FileSystem can register MIME types for a well-known extensions: FileUtil.setMIMEType(String ext, String mimeType) or together with filesystem supply some resolvers subclassed from MIMEResolver.

Specified by:
mimeType in interface AbstractFileSystem.Info
Parameters:
name - the file to test
Returns:
the MIME type textual representation (e.g. "text/plain") or null if no special support for recognizing MIME is implemented.

size

public long size(String name)
Description copied from interface: AbstractFileSystem.Info
Get the size of the file.

Specified by:
size in interface AbstractFileSystem.Info
Parameters:
name - the file to test
Returns:
the size of the file in bytes, or zero if the file does not contain data (does not exist or is a folder).

inputStream

public InputStream inputStream(String name)
                        throws FileNotFoundException
Description copied from interface: AbstractFileSystem.Info
Get input stream.

Specified by:
inputStream in interface AbstractFileSystem.Info
Parameters:
name - the file to test
Returns:
an input stream to read the contents of this file
Throws:
FileNotFoundException - if the file does not exist or is invalid

outputStream

public OutputStream outputStream(String name)
                          throws IOException
Description copied from interface: AbstractFileSystem.Info
Get output stream.

Specified by:
outputStream in interface AbstractFileSystem.Info
Parameters:
name - the file to test
Returns:
output stream to overwrite the contents of this file
Throws:
IOException - if an error occurs (the file is invalid, etc.)

lock

public void lock(String name)
          throws IOException
Description copied from interface: AbstractFileSystem.Info
Lock the file. May do nothing if the underlying storage does not support locking. This does not affect locking using FileLock within NetBeans, however.

Specified by:
lock in interface AbstractFileSystem.Info
Parameters:
name - name of the file
Throws:
IOException - (e.g. FileAlreadyLockedException) if the file is already locked or otherwise cannot be locked

unlock

public void unlock(String name)
Description copied from interface: AbstractFileSystem.Info
Unlock the file.

Specified by:
unlock in interface AbstractFileSystem.Info
Parameters:
name - name of the file

markUnimportant

public void markUnimportant(String name)
Description copied from interface: AbstractFileSystem.Info
Mark the file as being unimportant. If not called, the file is assumed to be important. Deprecated and new implementations need not do anything.

Specified by:
markUnimportant in interface AbstractFileSystem.Info
Parameters:
name - the file to mark

readAttribute

public Object readAttribute(String name,
                            String attrName)
Description copied from interface: AbstractFileSystem.Attr
Get the file attribute with the specified name.

Specified by:
readAttribute in interface AbstractFileSystem.Attr
Parameters:
name - the file
attrName - name of the attribute
Returns:
appropriate (serializable) value or null if the attribute is unset (or could not be properly restored for some reason)

writeAttribute

public void writeAttribute(String name,
                           String attrName,
                           Object value)
                    throws IOException
Description copied from interface: AbstractFileSystem.Attr
Set the file attribute with the specified name.

Specified by:
writeAttribute in interface AbstractFileSystem.Attr
Parameters:
name - the file
attrName - name of the attribute
value - new value or null to clear the attribute. Must be serializable, although particular filesystems may or may not use serialization to store attribute values.
Throws:
IOException - if the attribute cannot be set. If serialization is used to store it, this may in fact be a subclass such as NotSerializableException.

attributes

public Enumeration<String> attributes(String name)
Description copied from interface: AbstractFileSystem.Attr
Get all file attribute names for the file.

Specified by:
attributes in interface AbstractFileSystem.Attr
Parameters:
name - the file
Returns:
enumeration of keys (as strings)

renameAttributes

public void renameAttributes(String oldName,
                             String newName)
Description copied from interface: AbstractFileSystem.Attr
Called when a file is renamed, to appropriately update its attributes.

Specified by:
renameAttributes in interface AbstractFileSystem.Attr
Parameters:
oldName - old name of the file
newName - new name of the file

deleteAttributes

public void deleteAttributes(String name)
Description copied from interface: AbstractFileSystem.Attr
Called when a file is deleted, to also delete its attributes.

Specified by:
deleteAttributes in interface AbstractFileSystem.Attr
Parameters:
name - name of the file

org.openide.filesystems 7.3.1

Built on January 29 2008.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.