org.openide.filesystems 7.3.1

org.openide.filesystems
Class LocalFileSystem.Impl

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

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

The implementation class that implements List, Info and Change interfaces and delegates all the methods to appropriate methods of LocalFileSystem.

See Also:
Serialized Form

Constructor Summary
LocalFileSystem.Impl(LocalFileSystem fs)
          Pointer to local filesystem
 
Method Summary
 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.
 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.
 boolean readOnly(String name)
          Test whether this file can be written to or not.
 void rename(String oldName, String newName)
          Rename a file.
 long size(String name)
          Get the size of the file.
 void unlock(String name)
          Unlock the file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalFileSystem.Impl

public LocalFileSystem.Impl(LocalFileSystem fs)
Pointer to local filesystem

Parameters:
fs - the filesystem this impl is connected 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

org.openide.filesystems 7.3.1

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