All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.as400.access.IFSFile

java.lang.Object
   |
   +----com.ibm.as400.access.IFSFile

public class IFSFile
extends Object
implements Serializable
The IFSFile class represents an object in the AS/400 integrated file system.
IFSFile objects are capable of generating file events that call the following FileListener methods: fileDeleted and fileModified.
The following example demonstrates the use of IFSFile:
// Work with /Dir/File.txt on the system eniac.
AS400 as400 = new AS400("eniac");
IFSFile file = new IFSFile(as400, "/Dir/File.txt");
// Determine the parent directory of the file. String directory = file.getParent();
// Determine the name of the file. String name = file.getName();
// Determine the file size. long length = file.length(); // Determine when the file was last modified. Date date = new Date(file.lastModified());
// Delete the file. if (file.delete() == false) { // Display the error code. System.out.println("Unable to delete file."); }

See Also:
FileEvent, addFileListener, removeFileListener

Variable Index

 o pathSeparator
The integrated file system path separator string used to separate paths in a path list.
 o pathSeparatorChar
The integrated file system path separator character used to separate paths in a path list.
 o separator
The integrated file system directory separator string used to separate directory/file components in a path.
 o separatorChar
The integrated file system directory separator character used to separate directory/file components in a path.

Constructor Index

 o IFSFile()
Constructs an IFSFile object.
 o IFSFile(AS400, IFSFile, String)
Constructs an IFSFile object.
 o IFSFile(AS400, IFSJavaFile, String)
 o IFSFile(AS400, String)
Constructs an IFSFile object.
 o IFSFile(AS400, String, String)
Constructs an IFSFile object.

Method Index

 o addFileListener(FileListener)
Adds a file listener to receive file events from this IFSFile.
 o addPropertyChangeListener(PropertyChangeListener)
Adds a property change listener.
 o addVetoableChangeListener(VetoableChangeListener)
Adds a vetoable change listener.
 o canRead()
Determines if the applet or application can read from the integrated file system object represented by this object.
 o canWrite()
Determines if the applet or application can write to the integrated file system object represented by this object.
 o delete()
Deletes the integrated file system object represented by this object.
 o equals(Object)
Determines if two IFSFile objects are equal.
 o exists()
Determines if the integrated file system object represented by this object exists.
 o finalize()
Cleans up.
 o getAbsolutePath()
Returns the path name of the integrated file system object represented by this object.
 o getCanonicalPath()
Returns the path name of the integrated file system object represented by this object.
 o getFileSystem()
Returns the full path of the object.
 o getFreeSpace()
Determines the amount of unused storage space in the file system.
 o getName()
Determines the name of the integrated file system object represented by this object.
 o getParent()
Returns the parent directory of the integrated file system object represented by this object.
 o getPath()
Returns the path of the integrated file system object represented by this object.
 o getPermission()
Returns the permission of the object.
 o getSystem()
Returns the system that this object references.
 o hashCode()
Computes a hash code for this object.
 o isAbsolute()
Determines if the path name of this integrated file system object is an absolute path name.
 o isDirectory()
Determines if the integrated file system object represented by this object is a directory.
 o isFile()
Determines if the integrated file system object represented by this object is a "normal" file.
A file is "normal" if it is not a directory or a container of other objects.
 o lastModified()
Determines the time that the integrated file system object represented by this object was last modified.
 o length()
Determines the length of the integrated file system object represented by this object.
 o list()
Lists the integrated file system objects in the directory represented by this object.
 o list(IFSFileFilter)
Lists the integrated file system objects in the directory represented by this object that satisfy filter.
 o list(IFSFileFilter, String)
Lists the integrated file system objects in the directory represented by this object that satisfy filter.
 o list(String)
Lists the integrated file system objects in the directory represented by this object that match pattern.
 o mkdir()
Creates an integrated file system directory whose path name is specified by this object.
 o mkdirs()
Creates an integrated file system directory whose path name is specified by this object.
 o removeFileListener(FileListener)
Removes a file listener so that it no longer receives file events from this IFSFile.
 o removePropertyChangeListener(PropertyChangeListener)
Removes a property change listener.
 o removeVetoableChangeListener(VetoableChangeListener)
Removes a vetoable change listener.
 o renameTo(IFSFile)
Renames the integrated file system object specified by this object to have the path name of file.
 o setLastModified(long)
Changes the last modified time of the integrated file system object represented by this object to time.
 o setPath(String)
Sets the file path.
 o setPermission(Permission)
Sets the permission of the object.
 o setSystem(AS400)
Sets the system.
 o toString()
Generates a String representation of this object.

Variables

 o pathSeparator
 public static final String pathSeparator
The integrated file system path separator string used to separate paths in a path list.

 o pathSeparatorChar
 public static final char pathSeparatorChar
The integrated file system path separator character used to separate paths in a path list.

 o separator
 public static final String separator
The integrated file system directory separator string used to separate directory/file components in a path.

 o separatorChar
 public static final char separatorChar
The integrated file system directory separator character used to separate directory/file components in a path.

Constructors

 o IFSFile
 public IFSFile()
Constructs an IFSFile object. It creates a default IFSFile instance.

 o IFSFile
 public IFSFile(AS400 system,
                IFSFile directory,
                String name)
Constructs an IFSFile object. It creates an IFSFile instance that represents the integrated file system object on system that has a path name of directory, that is followed by the separator character and name.

Parameters:
system - The AS400 that contains the file.
directory - The directory.
name - The file name.
 o IFSFile
 public IFSFile(AS400 system,
                String path)
Constructs an IFSFile object. It creates an IFSFile instance that represents the integrated file system object on system that has a path name of path.

Parameters:
system - The AS400 that contains the file.
path - The file path name.
 o IFSFile
 public IFSFile(AS400 system,
                String directory,
                String name)
Constructs an IFSFile object. It creates an IFSFile instance that represents the integrated file system object on system that has a path name is of directory, followed by the separator character and name.

Parameters:
system - The AS400 that contains the file.
path - The directory path name.
name - The file name.
 o IFSFile
 public IFSFile(AS400 system,
                IFSJavaFile directory,
                String name)
Parameters:
system - The AS400 that contains the file.
directory - The directory.
name - The file name.

Methods

 o addFileListener
 public synchronized void addFileListener(FileListener listener)
Adds a file listener to receive file events from this IFSFile.

Parameters:
listener - The file listener.
 o addPropertyChangeListener
 public synchronized void addPropertyChangeListener(PropertyChangeListener listener)
Adds a property change listener.

Parameters:
listener - The property change listener to add.
 o addVetoableChangeListener
 public synchronized void addVetoableChangeListener(VetoableChangeListener listener)
Adds a vetoable change listener.

Parameters:
listener - The vetoable change listener to add.
 o canRead
 public boolean canRead() throws IOException
Determines if the applet or application can read from the integrated file system object represented by this object.

Returns:
true if the object exists and is readable; false otherwise.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: ExtendedIOException
If an error occurs while communicating with the AS/400.
Throws: InterruptedIOException
If this thread is interrupted.
Throws: ServerStartupException
If the AS/400 server cannot be started.
Throws: UnknownHostException
If the AS/400 system cannot be located.
 o canWrite
 public boolean canWrite() throws IOException
Determines if the applet or application can write to the integrated file system object represented by this object.

Returns:
true if the object exists and is writeable; false otherwise.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: ExtendedIOException
If an error occurs while communicating with the AS/400.
Throws: InterruptedIOException
If this thread is interrupted.
Throws: ServerStartupException
If the AS/400 server cannot be started.
Throws: UnknownHostException
If the AS/400 system cannot be located.
 o delete
 public boolean delete() throws IOException
Deletes the integrated file system object represented by this object.

Returns:
true if the object is successfully deleted; false otherwise.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: ExtendedIOException
If an error occurs while communicating with the AS/400.
Throws: InterruptedIOException
If this thread is interrupted.
Throws: ServerStartupException
If the AS/400 server cannot be started.
Throws: UnknownHostException
If the AS/400 system cannot be located.
 o equals
 public boolean equals(Object obj)
Determines if two IFSFile objects are equal.

Parameters:
obj - The object with which to compare.
Returns:
true if the path name and system name of the objects are equal; false otherwise.
Overrides:
equals in class Object
 o exists
 public boolean exists() throws IOException
Determines if the integrated file system object represented by this object exists.

Returns:
true if the object exists; false otherwise.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: ExtendedIOException
If an error occurs while communicating with the AS/400.
Throws: InterruptedIOException
If this thread is interrupted.
Throws: ServerStartupException
If the AS/400 server cannot be started.
Throws: UnknownHostException
If the AS/400 system cannot be located.
 o finalize
 protected void finalize() throws Throwable
Cleans up.

Throws: Throwable
If an error occurs.
Overrides:
finalize in class Object
 o getAbsolutePath
 public String getAbsolutePath()
Returns the path name of the integrated file system object represented by this object. This is the full path starting at the root directory.

Returns:
The absolute path name of this integrated file system object.
 o getCanonicalPath
 public String getCanonicalPath()
Returns the path name of the integrated file system object represented by this object. This is the full path starting at the root directory.

Returns:
The canonical path name of this integrated file system object.
 o getFileSystem
 public String getFileSystem()
Returns the full path of the object.

Returns:
The full path of the object.
 o getFreeSpace
 public long getFreeSpace() throws IOException
Determines the amount of unused storage space in the file system.

Returns:
The number of bytes of storage available.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: ExtendedIOException
If an error occurs while communicating with the AS/400.
Throws: InterruptedIOException
If this thread is interrupted.
Throws: ServerStartupException
If the AS/400 server cannot be started.
Throws: UnknownHostException
If the AS/400 system cannot be located.
 o getName
 public String getName()
Determines the name of the integrated file system object represented by this object.

Returns:
The name (without directory components).
 o getParent
 public String getParent()
Returns the parent directory of the integrated file system object represented by this object. The parent directory is everything in the path name before the last occurrence of the separator character, or null if the separator character does not appear in the path name.

Returns:
The parent directory.
 o getPath
 public String getPath()
Returns the path of the integrated file system object represented by this object.

Returns:
The integrated file system path name.
 o getPermission
 public Permission getPermission() throws AS400Exception, AS400SecurityException, ConnectionDroppedException, ErrorCompletingRequestException, InterruptedException, ObjectDoesNotExistException, IOException, PropertyVetoException, UnsupportedEncodingException
Returns the permission of the object.

Returns:
The permission of the object.
Throws: AS400Exception
If the AS/400 system returns an error message.
Throws: AS400SecurityException
If a security or authority error occurs.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: ErrorCompletingRequestException
If an error occurs before the request is completed.
Throws: InterruptedException
If this thread is interrupted.
Throws: IOException
If an error occurs while communicationg with the AS/400.
Throws: ObjectDoesNotExistException
If the AS/400 object does not exist.
Throws: PropertyVetoException
If the change is vetoed.
Throws: UnknownHostException
If the AS/400 system cannot be located.
See Also:
setPermission
 o getSystem
 public AS400 getSystem()
Returns the system that this object references.

Returns:
The system object.
 o hashCode
 public int hashCode()
Computes a hash code for this object.

Returns:
A hash code value for this object.
Overrides:
hashCode in class Object
 o isAbsolute
 public boolean isAbsolute()
Determines if the path name of this integrated file system object is an absolute path name.

Returns:
true if the path name specification is absolute; false otherwise.
 o isDirectory
 public boolean isDirectory() throws IOException
Determines if the integrated file system object represented by this object is a directory.

Returns:
true if the integrated file system object exists and is a directory; false otherwise.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: ExtendedIOException
If an error occurs while communicating with the AS/400.
Throws: InterruptedIOException
If this thread is interrupted.
Throws: ServerStartupException
If the AS/400 server cannot be started.
Throws: UnknownHostException
If the AS/400 system cannot be located.
 o isFile
 public boolean isFile() throws IOException
Determines if the integrated file system object represented by this object is a "normal" file.
A file is "normal" if it is not a directory or a container of other objects.

Returns:
true if the specified file exists and is a "normal" file; false otherwise.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: ExtendedIOException
If an error occurs while communicating with the AS/400.
Throws: InterruptedIOException
If this thread is interrupted.
Throws: ServerStartupException
If the AS/400 server cannot be started.
Throws: UnknownHostException
If the AS/400 system cannot be located.
 o lastModified
 public long lastModified() throws IOException
Determines the time that the integrated file system object represented by this object was last modified.

Returns:
The time (measured in milliseconds since 01/01/1970 00:00:00 GMT) that the integrated file system object was last modified, or 0L if it does not exist.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: ExtendedIOException
If an error occurs while communicating with the AS/400.
Throws: InterruptedIOException
If this thread is interrupted.
Throws: ServerStartupException
If the AS/400 server cannot be started.
Throws: UnknownHostException
If the AS/400 system cannot be located.
 o length
 public long length() throws IOException
Determines the length of the integrated file system object represented by this object.

Returns:
The length, in bytes, of the integrated file system object, or 0L if it does not exist.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: ExtendedIOException
If an error occurs while communicating with the AS/400.
Throws: InterruptedIOException
If this thread is interrupted.
Throws: ServerStartupException
If the AS/400 server cannot be started.
Throws: UnknownHostException
If the AS/400 system cannot be located.
 o list
 public String[] list() throws IOException
Lists the integrated file system objects in the directory represented by this object.

Returns:
An array of object names in the directory. This list does not include the current directory or the parent directory. If this object does not represent a directory, null is returned. If this object represents an empty directory, an empty string array is returned.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: ExtendedIOException
If an error occurs while communicating with the AS/400.
Throws: InterruptedIOException
If this thread is interrupted.
Throws: ServerStartupException
If the AS/400 server cannot be started.
Throws: UnknownHostException
If the AS/400 system cannot be located.
 o list
 public String[] list(IFSFileFilter filter) throws IOException
Lists the integrated file system objects in the directory represented by this object that satisfy filter.

Parameters:
filter - A file object filter.
Returns:
An array of object names in the directory that satisfy the filter. This list does not include the current directory or the parent directory. If this object does not represent a directory, null is returned. If this object represents an empty directory, or the filter does not match any files, an empty string array is returned. The IFSFile object passed to the filter object have cached file attribute information. Maintaining references to these IFSFile objects after the list operation increases the chances that their file attribute information will not be valid.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: ExtendedIOException
If an error occurs while communicating with the AS/400.
Throws: InterruptedIOException
If this thread is interrupted.
Throws: ServerStartupException
If the AS/400 server cannot be started.
Throws: UnknownHostException
If the AS/400 system cannot be located.
 o list
 public String[] list(IFSFileFilter filter,
                      String pattern) throws IOException
Lists the integrated file system objects in the directory represented by this object that satisfy filter.

Parameters:
filter - A file object filter.
pattern - The pattern that all filenames must match. Acceptable characters are wildcards (*) and question marks (?).
Returns:
An array of object names in the directory that satisfy the filter and pattern. This list does not include the current directory or the parent directory. If this object does not represent a directory, null is returned. If this object represents an empty directory, or the filter or pattern does not match any files, an empty string array is returned. The IFSFile object passed to the filter object have cached file attribute information. Maintaining references to these IFSFile objects after the list operation increases the chances that their file attribute information will not be valid.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: ExtendedIOException
If an error occurs while communicating with the AS/400.
Throws: InterruptedIOException
If this thread is interrupted.
Throws: ServerStartupException
If the AS/400 server cannot be started.
Throws: UnknownHostException
If the AS/400 system cannot be located.
 o list
 public String[] list(String pattern) throws IOException
Lists the integrated file system objects in the directory represented by this object that match pattern.

Parameters:
pattern - The pattern that all filenames must match. Acceptable characters are wildcards (*) and question marks (?).
Returns:
An array of object names in the directory that match the pattern. This list does not include the current directory or the parent directory. If this object does not represent a directory, null is returned. If this object represents an empty directory, or the pattern does not match any files, an empty string array is returned.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: ExtendedIOException
If an error occurs while communicating with the AS/400.
Throws: InterruptedIOException
If this thread is interrupted.
Throws: ServerStartupException
If the AS/400 server cannot be started.
Throws: UnknownHostException
If the AS/400 system cannot be located.
 o mkdir
 public boolean mkdir() throws IOException
Creates an integrated file system directory whose path name is specified by this object.

Returns:
true if the directory was created; false otherwise.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: ExtendedIOException
If an error occurs while communicating with the AS/400.
Throws: InterruptedIOException
If this thread is interrupted.
Throws: ServerStartupException
If the AS/400 server cannot be started.
Throws: UnknownHostException
If the AS/400 system cannot be located.
 o mkdirs
 public boolean mkdirs() throws IOException
Creates an integrated file system directory whose path name is specified by this object. In addition, create all parent directories as necessary.

Returns:
true if the directory (or directories) were created; false otherwise.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: ExtendedIOException
If an error occurs while communicating with the AS/400.
Throws: InterruptedIOException
If this thread is interrupted.
Throws: ServerStartupException
If the AS/400 server cannot be started.
Throws: UnknownHostException
If the AS/400 system cannot be located.
 o removeFileListener
 public synchronized void removeFileListener(FileListener listener)
Removes a file listener so that it no longer receives file events from this IFSFile.

Parameters:
listener - The file listener.
 o removePropertyChangeListener
 public synchronized void removePropertyChangeListener(PropertyChangeListener listener)
Removes a property change listener.

Parameters:
listener - The property change listener to remove.
 o removeVetoableChangeListener
 public synchronized void removeVetoableChangeListener(VetoableChangeListener listener)
Removes a vetoable change listener.

Parameters:
listener - The vetoable change listener to remove.
 o renameTo
 public boolean renameTo(IFSFile file) throws IOException, PropertyVetoException
Renames the integrated file system object specified by this object to have the path name of file. Wildcards are not permitted in this file name.

Parameters:
file - The new file name.
Returns:
true if successful; false otherwise.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: ExtendedIOException
If an error occurs while communicating with the AS/400.
Throws: InterruptedIOException
If this thread is interrupted.
Throws: PropertyVetoException
If the change is vetoed.
Throws: ServerStartupException
If the AS/400 server cannot be started.
Throws: UnknownHostException
If the AS/400 system cannot be located.
 o setPath
 public void setPath(String path) throws PropertyVetoException
Sets the file path.

Parameters:
path - The absolute file path.
Throws: PropertyVetoException
If the change is vetoed.
 o setLastModified
 public boolean setLastModified(long time) throws IOException, PropertyVetoException
Changes the last modified time of the integrated file system object represented by this object to time.

Parameters:
time - The desired last modification time (measured in milliseconds since January 1, 1970 00:00:00 GMT).
Returns:
true if successful; false otherwise.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: ExtendedIOException
If an error occurs while communicating with the AS/400.
Throws: InterruptedIOException
If this thread is interrupted.
Throws: ServerStartupException
If the AS/400 server cannot be started.
Throws: UnknownHostException
If the AS/400 system cannot be located.
Throws: PropertyVetoException
If the change is vetoed.
 o setPermission
 public void setPermission(Permission permission) throws AS400Exception, AS400SecurityException, ConnectionDroppedException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException, ServerStartupException, PropertyVetoException, UnknownHostException
Sets the permission of the object.

Parameters:
permission - The permission that will be set to the object.
Throws: AS400Exception
If the AS/400 system returns an error message.
Throws: AS400SecurityException
If a security or authority error occurs.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: ErrorCompletingRequestException
If an error occurs before the request is completed.
Throws: InterruptedException
If this thread is interrupted.
Throws: IOException
If an error occurs while communicationg with the AS/400.
Throws: ObjectDoesNotExistException
If the AS/400 object does not exist.
Throws: PropertyVetoException
If the change is vetoed.
Throws: UnknownHostException
If the AS/400 system cannot be located.
See Also:
getPermission
 o setSystem
 public void setSystem(AS400 system) throws PropertyVetoException
Sets the system.

Parameters:
system - The AS/400 system object.
Throws: PropertyVetoException
If the change is vetoed.
 o toString
 public String toString()
Generates a String representation of this object.

Returns:
The path name of the integrated file system object represented by this object.
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index