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
-
pathSeparator
- The integrated file system path separator string used to separate paths in a path list.
-
pathSeparatorChar
- The integrated file system path separator character used to separate paths in a path list.
-
separator
- The integrated file system directory separator string used to separate directory/file components in a path.
-
separatorChar
- The integrated file system directory separator character used to separate directory/file components in a path.
-
IFSFile()
- Constructs an IFSFile object.
-
IFSFile(AS400, IFSFile, String)
- Constructs an IFSFile object.
-
IFSFile(AS400, IFSJavaFile, String)
-
-
IFSFile(AS400, String)
- Constructs an IFSFile object.
-
IFSFile(AS400, String, String)
- Constructs an IFSFile object.
-
addFileListener(FileListener)
- Adds a file listener to receive file events from this IFSFile.
-
addPropertyChangeListener(PropertyChangeListener)
- Adds a property change listener.
-
addVetoableChangeListener(VetoableChangeListener)
- Adds a vetoable change listener.
-
canRead()
- Determines if the applet or application can read from the integrated file system object represented by this object.
-
canWrite()
- Determines if the applet or application can write to the integrated file system object represented by this object.
-
delete()
- Deletes the integrated file system object represented by this object.
-
equals(Object)
- Determines if two IFSFile objects are equal.
-
exists()
- Determines if the integrated file system object represented by this object exists.
-
finalize()
- Cleans up.
-
getAbsolutePath()
- Returns the path name of the integrated file system object represented by this object.
-
getCanonicalPath()
- Returns the path name of the integrated file system object represented by this object.
-
getFileSystem()
- Returns the full path of the object.
-
getFreeSpace()
- Determines the amount of unused storage space in the file system.
-
getName()
- Determines the name of the integrated file system object represented by this object.
-
getParent()
- Returns the parent directory of the integrated file system object represented by this object.
-
getPath()
- Returns the path of the integrated file system object represented by this object.
-
getPermission()
- Returns the permission of the object.
-
getSystem()
- Returns the system that this object references.
-
hashCode()
- Computes a hash code for this object.
-
isAbsolute()
- Determines if the path name of this integrated file system object is an
absolute path name.
-
isDirectory()
- Determines if the integrated file system object represented by this object is a directory.
-
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.
-
lastModified()
- Determines the time that the integrated file system object represented by this object was last modified.
-
length()
- Determines the length of the integrated file system object represented by this object.
-
list()
- Lists the integrated file system objects in the directory represented by this object.
-
list(IFSFileFilter)
- Lists the integrated file system objects in the directory represented by this object that satisfy filter.
-
list(IFSFileFilter, String)
- Lists the integrated file system objects in the directory represented by this object that satisfy filter.
-
list(String)
- Lists the integrated file system objects in the directory represented by this object that match pattern.
-
mkdir()
- Creates an integrated file system directory whose path name is specified by this object.
-
mkdirs()
- Creates an integrated file system directory whose path name is specified by this object.
-
removeFileListener(FileListener)
- Removes a file listener so that it no longer receives file events from
this IFSFile.
-
removePropertyChangeListener(PropertyChangeListener)
- Removes a property change listener.
-
removeVetoableChangeListener(VetoableChangeListener)
- Removes a vetoable change listener.
-
renameTo(IFSFile)
- Renames the integrated file system object specified by this object to have the path name of file.
-
setLastModified(long)
- Changes the last modified time of the integrated file system object represented by this object to time.
-
setPath(String)
- Sets the file path.
-
setPermission(Permission)
- Sets the permission of the object.
-
setSystem(AS400)
- Sets the system.
-
toString()
- Generates a String representation of this object.
pathSeparator
public static final String pathSeparator
- The integrated file system path separator string used to separate paths in a path list.
pathSeparatorChar
public static final char pathSeparatorChar
- The integrated file system path separator character used to separate paths in a path list.
separator
public static final String separator
- The integrated file system directory separator string used to separate directory/file components in a path.
separatorChar
public static final char separatorChar
- The integrated file system directory separator character used to separate directory/file components in a path.
IFSFile
public IFSFile()
- Constructs an IFSFile object.
It creates a default IFSFile instance.
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.
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.
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.
IFSFile
public IFSFile(AS400 system,
IFSJavaFile directory,
String name)
- Parameters:
- system - The AS400 that contains the file.
- directory - The directory.
- name - The file name.
addFileListener
public synchronized void addFileListener(FileListener listener)
- Adds a file listener to receive file events from this IFSFile.
- Parameters:
- listener - The file listener.
addPropertyChangeListener
public synchronized void addPropertyChangeListener(PropertyChangeListener listener)
- Adds a property change listener.
- Parameters:
- listener - The property change listener to add.
addVetoableChangeListener
public synchronized void addVetoableChangeListener(VetoableChangeListener listener)
- Adds a vetoable change listener.
- Parameters:
- listener - The vetoable change listener to add.
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.
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.
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.
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
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.
finalize
protected void finalize() throws Throwable
- Cleans up.
- Throws: Throwable
- If an error occurs.
- Overrides:
- finalize in class Object
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.
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.
getFileSystem
public String getFileSystem()
- Returns the full path of the object.
- Returns:
- The full path of the object.
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.
getName
public String getName()
- Determines the name of the integrated file system object represented by this object.
- Returns:
- The name (without directory components).
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.
getPath
public String getPath()
- Returns the path of the integrated file system object represented by this object.
- Returns:
- The integrated file system path name.
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
getSystem
public AS400 getSystem()
- Returns the system that this object references.
- Returns:
- The system object.
hashCode
public int hashCode()
- Computes a hash code for this object.
- Returns:
- A hash code value for this object.
- Overrides:
- hashCode in class Object
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
removePropertyChangeListener
public synchronized void removePropertyChangeListener(PropertyChangeListener listener)
- Removes a property change listener.
- Parameters:
- listener - The property change listener to remove.
removeVetoableChangeListener
public synchronized void removeVetoableChangeListener(VetoableChangeListener listener)
- Removes a vetoable change listener.
- Parameters:
- listener - The vetoable change listener to remove.
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.
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.
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.
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
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.
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