站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc 4.1.0

XMLFileSystem.Impl (NetBeans APIs) - NetBeans API Javadoc 4.1.0


org.openide.filesystems
Class XMLFileSystem.Impl

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

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

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

See Also:
Serialized Form

Constructor Summary
XMLFileSystem.Impl(XMLFileSystem fs)
          Constructor.
 
Method Summary
 Enumeration attributes(String name)
          Get all file attribute names for the file.
 String[] children(String name)
          Scans children for given name
 void createData(String name)
          Create new data file.
 void createFolder(String name)
          Creates new folder named name.
 void delete(String name)
          Delete the 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 folder or contains data.
 InputStream inputStream(String name)
          Get input stream.
 Date lastModified(String name)
          Get last modification time.
 void lock(String name)
          Does nothing to lock the file.
 void markUnimportant(String name)
          Does nothing.
 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)
          Does nothing to 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

XMLFileSystem.Impl

public XMLFileSystem.Impl(XMLFileSystem fs)
Constructor.

Parameters:
fs - the filesystem to delegate to
Method Detail

children

public String[] children(String name)
Scans children for given name

Specified by:
children in interface AbstractFileSystem.List
Parameters:
name - the folder, by name; e.g. top/next/afterthat
Returns:
array of children`s names

createFolder

public void createFolder(String name)
                  throws IOException
Creates new folder named name.

Specified by:
createFolder in interface AbstractFileSystem.Change
Parameters:
name - name of folder
Throws:
IOException - if operation fails

createData

public void createData(String name)
                throws IOException
Create new data file.

Specified by:
createData in interface AbstractFileSystem.Change
Parameters:
name - name of the file
Throws:
IOException - if the file cannot be created (e.g. already exists)

rename

public void rename(String oldName,
                   String newName)
            throws IOException
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
Delete the file.

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

lastModified

public Date lastModified(String name)
Get last modification time.

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

folder

public boolean folder(String name)
Test if the file is 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 otherwise

readOnly

public boolean readOnly(String name)
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 file is read-only

mimeType

public String mimeType(String name)
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)
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
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 exists or is invalid

outputStream

public OutputStream outputStream(String name)
                          throws IOException
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 occures (the file is invalid, etc.)

lock

public void lock(String name)
          throws IOException
Does nothing to lock the file.

Specified by:
lock in interface AbstractFileSystem.Info
Parameters:
name - name of the file
Throws:
IOException - if cannot be locked

unlock

public void unlock(String name)
Does nothing to unlock the file.

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

markUnimportant

public void markUnimportant(String name)
Does nothing.

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

readAttribute

public Object readAttribute(String name,
                            String attrName)
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
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 attributes(String name)
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)
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)
Called when a file is deleted, to also delete its attributes.

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


Built on May 4 2005.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.