com.ibm.as400.access
Class IFSFile
java.lang.Object
|
+--com.ibm.as400.access.IFSFile
- public class IFSFile
- extends java.lang.Object
- implements java.io.Serializable
The IFSFile class represents
an object in the AS/400 integrated file system.
As in java.io.File, IFSFile is designed to work
with the object as a whole. For example, use IFSFile
to delete or rename a file, to access the
file's attributes (is the object a file or a directory,
when was the file last changed, is the file hidden, etc.),
or to list the contents of a directory.
Use IFSFileInputStream or IFSRandomAccessFile to read
data from the file, and IFSFileOutputStream or IFSRandomAccessFile
to write data to the file.
Note that invalid symbolic links will return false to both
isFile() and isDirectory().
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 myAS400.
AS400 as400 = new AS400("myAS400");
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(com.ibm.as400.access.FileListener)
,
removeFileListener(com.ibm.as400.access.FileListener)
,
IFSFileInputStream
,
IFSFileOutputStream
,
IFSRandomAccessFile
, Serialized Form
Field Summary |
static java.lang.String |
pathSeparator
The integrated file system path separator string used to separate paths in a path list. |
static char |
pathSeparatorChar
The integrated file system path separator character used to separate paths in a
path list. |
static java.lang.String |
separator
The integrated file system directory separator string used to separate
directory/file components in a path. |
static char |
separatorChar
The integrated file system directory separator character used to separate
directory/file components in a path. |
Constructor Summary |
IFSFile()
Constructs an IFSFile object. |
IFSFile(AS400 system,
IFSFile directory,
java.lang.String name)
Constructs an IFSFile object. |
IFSFile(AS400 system,
IFSJavaFile directory,
java.lang.String name)
Constructs an IFSFile object. |
IFSFile(AS400 system,
java.lang.String path)
Constructs an IFSFile object. |
IFSFile(AS400 system,
java.lang.String directory,
java.lang.String name)
Constructs an IFSFile object. |
Method Summary |
void |
addFileListener(FileListener listener)
Adds a file listener to receive file events from this IFSFile. |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a property change listener. |
void |
addVetoableChangeListener(java.beans.VetoableChangeListener listener)
Adds a vetoable change listener. |
boolean |
canRead()
Determines if the applet or application can read from the integrated file system
object represented by this object. |
boolean |
canWrite()
Determines if the applet or application can write to the integrated file system
object represented by this object. |
void |
clearCachedAttributes()
Clear the cached attributes. |
long |
created()
Determines the time that the integrated file system object represented by this
object was created. |
boolean |
createNewFile()
Atomically create a new, empty file. |
boolean |
delete()
Deletes the integrated file system object represented by this object. |
java.util.Enumeration |
enumerateFiles()
Lists the integrated file system objects in the directory represented by this
object. |
java.util.Enumeration |
enumerateFiles(IFSFileFilter filter)
Lists the integrated file system objects in the directory represented by this
object that satisfy filter. |
java.util.Enumeration |
enumerateFiles(IFSFileFilter filter,
java.lang.String pattern)
Lists the integrated file system objects in the directory represented by this
object that satisfy filter. |
java.util.Enumeration |
enumerateFiles(java.lang.String pattern)
Lists the integrated file system objects in the directory represented by this
object. |
boolean |
equals(java.lang.Object obj)
Determines if two IFSFile objects are equal. |
boolean |
exists()
Determines if the integrated file system object represented by this object exists. |
java.lang.String |
getAbsolutePath()
Returns the path name of the integrated file system object represented by
this object. |
java.lang.String |
getCanonicalPath()
Returns the path name of the integrated file system object represented by
this object. |
int |
getCCSID()
Returns the file's CCSID. |
java.lang.String |
getFileSystem()
Returns the full path of the object. |
long |
getFreeSpace()
Determines the amount of unused storage space in the file system. |
java.lang.String |
getName()
Determines the name of the integrated file system object represented by this object. |
java.lang.String |
getParent()
Returns the parent directory of the integrated file system object
represented by this object. |
java.lang.String |
getPath()
Returns the path of the integrated file system object represented by this object. |
Permission |
getPermission()
Returns the permission of the object. |
java.lang.String |
getSubtype()
Returns the subtype of the integrated file system object represented by this object. |
AS400 |
getSystem()
Returns the system that this object references. |
int |
hashCode()
Computes a hash code for this object. |
boolean |
isAbsolute()
Determines if the path name of this integrated file system object is an
absolute path name. |
boolean |
isDirectory()
Determines if the integrated file system object represented by this object is a
directory.
Invalid symbolic links will return false to both isDirectory() and isFile(). |
boolean |
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. |
boolean |
isHidden()
Determines if the integrated file system object represented by this object is hidden. |
boolean |
isReadOnly()
Determines if the integrated file system object represented by this object is read only. |
long |
lastAccessed()
Determines the time that the integrated file system object represented by this
object was last accessed. |
long |
lastModified()
Determines the time that the integrated file system object represented by this
object was last modified. |
long |
length()
Determines the length of the integrated file system object represented by this
object. |
java.lang.String[] |
list()
Lists the integrated file system objects in the directory represented by this object. |
java.lang.String[] |
list(IFSFileFilter filter)
Lists the integrated file system objects in the directory represented by this
object that satisfy filter. |
java.lang.String[] |
list(IFSFileFilter filter,
java.lang.String pattern)
Lists the integrated file system objects in the directory represented by this
object that satisfy filter. |
java.lang.String[] |
list(java.lang.String pattern)
Lists the integrated file system objects in the directory represented
by this object that match pattern. |
IFSFile[] |
listFiles()
Lists the integrated file system objects in the directory represented by this
object. |
IFSFile[] |
listFiles(IFSFileFilter filter)
Lists the integrated file system objects in the directory represented by this
object. |
IFSFile[] |
listFiles(IFSFileFilter filter,
java.lang.String pattern)
Lists the integrated file system objects in the directory represented by this
object that satisfy filter. |
IFSFile[] |
listFiles(java.lang.String pattern)
Lists the integrated file system objects in the directory represented by this
object that match pattern. |
boolean |
mkdir()
Creates an integrated file system directory whose path name is
specified by this object. |
boolean |
mkdirs()
Creates an integrated file system directory whose path name is
specified by this object. |
void |
removeFileListener(FileListener listener)
Removes a file listener so that it no longer receives file events from
this IFSFile. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a property change listener. |
void |
removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
Removes a vetoable change listener. |
boolean |
renameTo(IFSFile file)
Renames the integrated file system object specified by this object to
have the path name of file. |
boolean |
setHidden()
Marks the integrated file system object represented by this object as hidden. |
boolean |
setHidden(boolean attribute)
Changes the hidden attribute of the integrated file system object
represented by this object. |
boolean |
setLastModified(long time)
Changes the last modified time of the integrated file system object
represented by this object to time. |
void |
setPath(java.lang.String path)
Sets the file path. |
void |
setPermission(Permission permission)
Sets the permission of the object. |
boolean |
setReadOnly()
Marks the integrated file system object represented by this object so
that only read operations are allowed. |
boolean |
setReadOnly(boolean attribute)
Changes the read only attribute of the integrated file system object
represented by this object. |
void |
setSystem(AS400 system)
Sets the system. |
java.lang.String |
toString()
Generates a String representation of this object. |
Methods inherited from class java.lang.Object |
clone,
finalize,
getClass,
notify,
notifyAll,
wait,
wait,
wait |
pathSeparator
public static final java.lang.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 java.lang.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,
java.lang.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,
java.lang.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,
java.lang.String directory,
java.lang.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,
java.lang.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.
addFileListener
public void addFileListener(FileListener listener)
- Adds a file listener to receive file events from this IFSFile.
- Parameters:
listener
- The file listener.
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
- Adds a property change listener.
- Parameters:
listener
- The property change listener to add.
addVetoableChangeListener
public void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
- Adds a vetoable change listener.
- Parameters:
listener
- The vetoable change listener to add.
canRead
public boolean canRead()
throws java.io.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.
- ExtendedIOException - If an error occurs while communicating with the AS/400.
- java.io.InterruptedIOException - If this thread is interrupted.
- ServerStartupException - If the AS/400 server cannot be started.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
canWrite
public boolean canWrite()
throws java.io.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.
- ExtendedIOException - If an error occurs while communicating with the AS/400.
- java.io.InterruptedIOException - If this thread is interrupted.
- ServerStartupException - If the AS/400 server cannot be started.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
clearCachedAttributes
public void clearCachedAttributes()
- Clear the cached attributes. This is needed when cached attributes
need to be refreshed.
- See Also:
listFiles()
created
public long created()
throws java.io.IOException
- Determines the time that the integrated file system object represented by this
object was created.
- Returns:
- The time (measured in milliseconds since 01/01/1970 00:00:00 GMT)
that the integrated file system object was created, or 0L if
the object does not exist or is not accessible.
- Throws:
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ExtendedIOException - If an error occurs while communicating with the AS/400.
- java.io.InterruptedIOException - If this thread is interrupted.
- ServerStartupException - If the AS/400 server cannot be started.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
createNewFile
public boolean createNewFile()
throws java.io.IOException
- Atomically create a new, empty file. The file is
created if and only if the file does not yet exist. The
check for existence and the file creation is a
single atomic operation.
- Returns:
- true if the file is created, false otherwise.
- Throws:
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ExtendedIOException - If an error occurs while communicating with the AS/400.
- java.io.InterruptedIOException - If this thread is interrupted.
- ServerStartupException - If the AS/400 server cannot be started.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
delete
public boolean delete()
throws java.io.IOException
- Deletes the integrated file system object represented by this object.
- Returns:
- true if the file system object is successfully deleted; false otherwise.
Returns false if the file system object did not exist prior to the delete() or is not accessible.
- Throws:
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ExtendedIOException - If an error occurs while communicating with the AS/400.
- java.io.InterruptedIOException - If this thread is interrupted.
- ServerStartupException - If the AS/400 server cannot be started.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
enumerateFiles
public java.util.Enumeration enumerateFiles(IFSFileFilter filter,
java.lang.String pattern)
throws java.io.IOException
- Lists the integrated file system objects in the directory represented by this
object that satisfy filter. The returned Enumeration contains an IFSFile
object for each file or directory in the list. The list is loaded incrementally,
which will improve initial response time for large lists.
- Parameters:
filter
- A file object filter.pattern
- The pattern that all filenames must match. Acceptable
characters are wildcards (*) and question marks (?).- Returns:
- An Enumeration of IFSFile objects which represent the contents of the directory that satisfy the filter
and pattern. This Enumeration does not include the current directory or the parent
directory. If this object does not represent a directory,
this object represents an empty directory, the filter or pattern does
not match any files, or the directory is not accessible, then an empty Enumeration is returned. The IFSFile object
passed to the filter object has cached file attribute information.
- Throws:
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ExtendedIOException - If an error occurs while communicating with the AS/400.
- java.io.InterruptedIOException - If this thread is interrupted.
- ServerStartupException - If the AS/400 server cannot be started.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
enumerateFiles
public java.util.Enumeration enumerateFiles(java.lang.String pattern)
throws java.io.IOException
- Lists the integrated file system objects in the directory represented by this
object. The returned Enumeration contains an IFSFile
object for each file or directory in the list. The list is loaded incrementally,
which will improve initial response time for large lists.
- Parameters:
pattern
- The pattern that all filenames must match. Acceptable
characters are wildcards (*) and question marks (?).- Returns:
- An Enumeration of IFSFile objects which represent the contents of the directory.
This Enumeration does not include the current directory or the parent
directory. If this object does not represent a directory,
this object represents an empty directory, the pattern does
not match any files, or the directory is not accessible, then an empty Enumeration is returned.
- Throws:
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ExtendedIOException - If an error occurs while communicating with the AS/400.
- java.io.InterruptedIOException - If this thread is interrupted.
- ServerStartupException - If the AS/400 server cannot be started.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
enumerateFiles
public java.util.Enumeration enumerateFiles(IFSFileFilter filter)
throws java.io.IOException
- Lists the integrated file system objects in the directory represented by this
object that satisfy filter. The returned Enumeration contains an IFSFile
object for each file or directory in the list. The list is loaded incrementally,
which will improve initial response time for large lists.
- Parameters:
filter
- A file object filter.- Returns:
- An Enumeration of IFSFile objects which represent the contents of the directory.
This Enumeration does not include the current directory or the parent
directory. If this object does not represent a directory,
this object represents an empty directory, the filter does
not match any files, or the directory is not accessible, then an empty Enumeration is returned. The IFSFile object
passed to the filter object has cached file attribute information.
- Throws:
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ExtendedIOException - If an error occurs while communicating with the AS/400.
- java.io.InterruptedIOException - If this thread is interrupted.
- ServerStartupException - If the AS/400 server cannot be started.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
enumerateFiles
public java.util.Enumeration enumerateFiles()
throws java.io.IOException
- Lists the integrated file system objects in the directory represented by this
object. The returned Enumeration contains an IFSFile
object for each file or directory in the list. The list is loaded incrementally,
which will improve initial response time for large lists.
- Returns:
- An Enumeration of IFSFile objects which represent the contents of the directory.
This Enumeration does not include the current directory or the parent
directory. If this object does not represent a directory,
this object represents an empty directory, the filter or pattern does
not match any files, or the directory not accessible, then an empty Enumeration is returned.
- Throws:
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ExtendedIOException - If an error occurs while communicating with the AS/400.
- java.io.InterruptedIOException - If this thread is interrupted.
- ServerStartupException - If the AS/400 server cannot be started.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
equals
public boolean equals(java.lang.Object obj)
- Determines if two IFSFile objects are equal.
- Overrides:
- equals in class java.lang.Object
- Parameters:
obj
- The object with which to compare.- Returns:
- true if the path name and system names of the objects are equal;
false otherwise.
exists
public boolean exists()
throws java.io.IOException
- Determines if the integrated file system object represented by this object exists.
- Returns:
- true if the object exists; false if the object does not exist or is not accessible.
- Throws:
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ExtendedIOException - If an error occurs while communicating with the AS/400.
- java.io.InterruptedIOException - If this thread is interrupted.
- ServerStartupException - If the AS/400 server cannot be started.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
getAbsolutePath
public java.lang.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 java.lang.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.
getCCSID
public int getCCSID()
throws java.io.IOException
- Returns the file's CCSID. All files in the AS/400's integrated file system
are tagged with a CCSID. This method returns the value of that tag.
If the file is non-existent or is a directory, returns -1.
- Returns:
- The file's CCSID.
getFileSystem
public java.lang.String getFileSystem()
- Returns the full path of the object.
- Returns:
- The full path of the object.
getFreeSpace
public long getFreeSpace()
throws java.io.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.
- ExtendedIOException - If an error occurs while communicating with the AS/400.
- java.io.InterruptedIOException - If this thread is interrupted.
- ServerStartupException - If the AS/400 server cannot be started.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
getName
public java.lang.String getName()
- Determines the name of the integrated file system object represented by this object.
- Returns:
- The name (without directory components).
getParent
public java.lang.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 java.lang.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,
java.lang.InterruptedException,
ObjectDoesNotExistException,
java.io.IOException,
java.io.UnsupportedEncodingException
- Returns the permission of the object.
- Returns:
- The permission of the object.
- Throws:
- AS400Exception - If the AS/400 system returns an error message.
- AS400SecurityException - If a security or authority error occurs.
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ErrorCompletingRequestException - If an error occurs before the request is completed.
- java.lang.InterruptedException - If this thread is interrupted.
- java.io.IOException - If an error occurs while communicationg with the AS/400.
- ObjectDoesNotExistException - If the AS/400 object does not exist.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
- See Also:
setPermission(com.ibm.as400.access.Permission)
getSubtype
public java.lang.String getSubtype()
throws java.io.IOException,
AS400SecurityException
- Returns the subtype of the integrated file system object represented by this object. Some possible values that might be returned include:
CMNF, DKTF, DSPF, ICFF, LF, PF, PRTF, SAVF, TAPF.
Returns a zero-length string if the object has no subtype,.
- Returns:
- The subtype of the object.
- Throws:
- ExtendedIOException - If an error occurs while communicating with the AS/400.
- AS400SecurityException - If a security or authority error occurs.
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.
- Overrides:
- hashCode in class java.lang.Object
- Returns:
- A hash code value for this 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 java.io.IOException
- Determines if the integrated file system object represented by this object is a
directory.
Invalid symbolic links will return false to both isDirectory() and isFile().
- Returns:
- true if the integrated file system object exists and is a directory; false otherwise.
- Throws:
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ExtendedIOException - If an error occurs while communicating with the AS/400.
- java.io.InterruptedIOException - If this thread is interrupted.
- ServerStartupException - If the AS/400 server cannot be started.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
isFile
public boolean isFile()
throws java.io.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.
Invalid symbolic links will return false to both isFile() and isDirectory().
- Returns:
- true if the specified file exists and is a "normal" file; false otherwise.
- Throws:
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ExtendedIOException - If an error occurs while communicating with the AS/400.
- java.io.InterruptedIOException - If this thread is interrupted.
- ServerStartupException - If the AS/400 server cannot be started.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
isHidden
public boolean isHidden()
throws java.io.IOException,
AS400SecurityException
- Determines if the integrated file system object represented by this object is hidden.
- Returns:
- true if the hidden attribute of this integrated file system object
is set; false otherwise.
- Throws:
- AS400SecurityException - If a security or authority error occurs.
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ExtendedIOException - If an error occurs while communicating with the AS/400.
- java.io.InterruptedIOException - If this thread is interrupted.
- ServerStartupException - If the AS/400 server cannot be started.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
isReadOnly
public boolean isReadOnly()
throws java.io.IOException,
AS400SecurityException
- Determines if the integrated file system object represented by this object is read only.
- Returns:
- true if the read only attribute of this integrated file system object
is set; false otherwise.
- Throws:
- AS400SecurityException - If a security or authority error occurs.
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ExtendedIOException - If an error occurs while communicating with the AS/400.
- java.io.InterruptedIOException - If this thread is interrupted.
- ServerStartupException - If the AS/400 server cannot be started.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
lastAccessed
public long lastAccessed()
throws java.io.IOException
- Determines the time that the integrated file system object represented by this
object was last accessed. With the use of the listFiles() function, attribute
information is cached and will not be automatically refreshed from the AS/400.
This means the reported last accessed time can become inconsistent with the AS/400.
- Returns:
- The time (measured in milliseconds since 01/01/1970 00:00:00 GMT)
that the integrated file system object was last accessed, or 0L if
the object does not exist or is not accessible.
- Throws:
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ExtendedIOException - If an error occurs while communicating with the AS/400.
- java.io.InterruptedIOException - If this thread is interrupted.
- ServerStartupException - If the AS/400 server cannot be started.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
lastModified
public long lastModified()
throws java.io.IOException
- Determines the time that the integrated file system object represented by this
object was last modified. With the use of the listFiles() function, attribute
information is cached and will not be automatically refreshed from the AS/400.
This means the reported last modified time can become inconsistent with the AS/400.
- 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
or is not accessible.
- Throws:
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ExtendedIOException - If an error occurs while communicating with the AS/400.
- java.io.InterruptedIOException - If this thread is interrupted.
- ServerStartupException - If the AS/400 server cannot be started.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
length
public long length()
throws java.io.IOException
- Determines the length of the integrated file system object represented by this
object. With the use of the listFiles() function, attribute
information is cached and will not be automatically refreshed from the AS/400.
This means the reported length can become inconsistent with the AS/400.
- Returns:
- The length, in bytes, of the integrated file system object, or
0L if it does not exist or is not accessible.
- Throws:
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ExtendedIOException - If an error occurs while communicating with the AS/400.
- java.io.InterruptedIOException - If this thread is interrupted.
- ServerStartupException - If the AS/400 server cannot be started.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
list
public java.lang.String[] list()
throws java.io.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, or the directory is not accessible, null is returned. If this object represents
an empty directory, an empty string array is returned.
- Throws:
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ExtendedIOException - If an error occurs while communicating with the AS/400.
- java.io.InterruptedIOException - If this thread is interrupted.
- ServerStartupException - If the AS/400 server cannot be started.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
list
public java.lang.String[] list(IFSFileFilter filter)
throws java.io.IOException
- Lists the integrated file system objects in the directory represented by this
object that satisfy filter.
- Parameters:
filter
- A file object filter. If null, then no filtering is done.- 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, or the directory is not accessible, 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.
- ExtendedIOException - If an error occurs while communicating with the AS/400.
- java.io.InterruptedIOException - If this thread is interrupted.
- ServerStartupException - If the AS/400 server cannot be started.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
list
public java.lang.String[] list(IFSFileFilter filter,
java.lang.String pattern)
throws java.io.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, or the directory is not accessible, 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.
- ExtendedIOException - If an error occurs while communicating with the AS/400.
- java.io.InterruptedIOException - If this thread is interrupted.
- ServerStartupException - If the AS/400 server cannot be started.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
list
public java.lang.String[] list(java.lang.String pattern)
throws java.io.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, or the directory is not accessible, 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.
- ExtendedIOException - If an error occurs while communicating with the AS/400.
- java.io.InterruptedIOException - If this thread is interrupted.
- ServerStartupException - If the AS/400 server cannot be started.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
listFiles
public IFSFile[] listFiles()
throws java.io.IOException
- Lists the integrated file system objects in the directory represented by this
object. With the use of this function, attribute information is cached and
will not be automatically refreshed from the AS/400. This means attribute
information can become inconsistent with the AS/400.
- Returns:
- An array of objects in the directory. This list does not
include the current directory or the parent directory. If this
object does not represent a directory, or the directory is not accessible, null is returned. If this
object represents an empty directory, an empty object array is returned.
- Throws:
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ExtendedIOException - If an error occurs while communicating with the AS/400.
- java.io.InterruptedIOException - If this thread is interrupted.
- ServerStartupException - If the AS/400 server cannot be started.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
listFiles
public IFSFile[] listFiles(IFSFileFilter filter)
throws java.io.IOException
- Lists the integrated file system objects in the directory represented by this
object. With the use of this function, attribute information is cached and
will not be automatically refreshed from the AS/400. This means attribute
information can become inconsistent with the AS/400.
- Returns:
- An array of objects in the directory. This list does not
include the current directory or the parent directory. If this
object does not represent a directory, or the directory is not accessible, null is returned. If this
object represents an empty directory, an empty object array is returned.
- Throws:
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ExtendedIOException - If an error occurs while communicating with the AS/400.
- java.io.InterruptedIOException - If this thread is interrupted.
- ServerStartupException - If the AS/400 server cannot be started.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
listFiles
public IFSFile[] listFiles(IFSFileFilter filter,
java.lang.String pattern)
throws java.io.IOException
- Lists the integrated file system objects in the directory represented by this
object that satisfy filter. With the use of this function, attribute
information is cached and will not be automatically refreshed from the AS/400.
This means attribute information can become inconsistent with the AS/400.
- 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, or the directory is not accessible, null is returned.
If this object represents an empty directory, or the filter or pattern does
not match any files, an empty object array is returned. The IFSFile object
passed to the filter object has 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.
- ExtendedIOException - If an error occurs while communicating with the AS/400.
- java.io.InterruptedIOException - If this thread is interrupted.
- ServerStartupException - If the AS/400 server cannot be started.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
listFiles
public IFSFile[] listFiles(java.lang.String pattern)
throws java.io.IOException
- Lists the integrated file system objects in the directory represented by this
object that match pattern. With the use of this function, attribute
information is cached and
will not be automatically refreshed from the AS/400. This means attribute
information can
become inconsistent with the AS/400.
- 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, or the directory is not accessible, null is returned. If this object
represents an empty directory, or the pattern does not match any files,
an empty object array is returned.
- Throws:
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ExtendedIOException - If an error occurs while communicating with the AS/400.
- java.io.InterruptedIOException - If this thread is interrupted.
- ServerStartupException - If the AS/400 server cannot be started.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
mkdir
public boolean mkdir()
throws java.io.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.
- ExtendedIOException - If an error occurs while communicating with the AS/400.
- java.io.InterruptedIOException - If this thread is interrupted.
- ServerStartupException - If the AS/400 server cannot be started.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
mkdirs
public boolean mkdirs()
throws java.io.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.
- ExtendedIOException - If an error occurs while communicating with the AS/400.
- java.io.InterruptedIOException - If this thread is interrupted.
- ServerStartupException - If the AS/400 server cannot be started.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
removeFileListener
public 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 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
- Removes a property change listener.
- Parameters:
listener
- The property change listener to remove.
removeVetoableChangeListener
public void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
- Removes a vetoable change listener.
- Parameters:
listener
- The vetoable change listener to remove.
renameTo
public boolean renameTo(IFSFile file)
throws java.io.IOException,
java.beans.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.
- ExtendedIOException - If an error occurs while communicating with the AS/400.
- java.io.InterruptedIOException - If this thread is interrupted.
- java.beans.PropertyVetoException - If the change is vetoed.
- ServerStartupException - If the AS/400 server cannot be started.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
setHidden
public boolean setHidden()
throws java.io.IOException
- Marks the integrated file system object represented by this object as hidden.
- Returns:
- true if successful; false otherwise.
- Throws:
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ExtendedIOException - If an error occurs while communicating with the AS/400.
- java.io.InterruptedIOException - If this thread is interrupted.
- ServerStartupException - If the AS/400 server cannot be started.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
setHidden
public boolean setHidden(boolean attribute)
throws java.io.IOException
- Changes the hidden attribute of the integrated file system object
represented by this object.
- Parameters:
attribute
- True to set the hidden attribute of the file.
False to turn off the hidden attribute.- Returns:
- true if successful; false otherwise.
- Throws:
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ExtendedIOException - If an error occurs while communicating with the AS/400.
- java.io.InterruptedIOException - If this thread is interrupted.
- ServerStartupException - If the AS/400 server cannot be started.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
setLastModified
public boolean setLastModified(long time)
throws java.io.IOException,
java.beans.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), or 0 to leave the last modification
time unchanged.- Returns:
- true if successful; false otherwise.
- Throws:
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ExtendedIOException - If an error occurs while communicating with the AS/400.
- java.io.InterruptedIOException - If this thread is interrupted.
- ServerStartupException - If the AS/400 server cannot be started.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
- java.beans.PropertyVetoException - If the change is vetoed.
setPath
public void setPath(java.lang.String path)
throws java.beans.PropertyVetoException
- Sets the file path.
- Parameters:
path
- The absolute file path.- Throws:
- java.beans.PropertyVetoException - If the change is vetoed.
setPermission
public void setPermission(Permission permission)
throws AS400Exception,
AS400SecurityException,
ConnectionDroppedException,
ErrorCompletingRequestException,
java.lang.InterruptedException,
java.io.IOException,
ObjectDoesNotExistException,
ServerStartupException,
java.beans.PropertyVetoException,
java.net.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.
- AS400SecurityException - If a security or authority error occurs.
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ErrorCompletingRequestException - If an error occurs before the request is completed.
- java.lang.InterruptedException - If this thread is interrupted.
- java.io.IOException - If an error occurs while communicationg with the AS/400.
- ObjectDoesNotExistException - If the AS/400 object does not exist.
- java.beans.PropertyVetoException - If the change is vetoed.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
- See Also:
getPermission()
setReadOnly
public boolean setReadOnly()
throws java.io.IOException
- Marks the integrated file system object represented by this object so
that only read operations are allowed.
- Returns:
- true if successful; false otherwise.
- Throws:
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ExtendedIOException - If an error occurs while communicating with the AS/400.
- java.io.InterruptedIOException - If this thread is interrupted.
- ServerStartupException - If the AS/400 server cannot be started.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
setReadOnly
public boolean setReadOnly(boolean attribute)
throws java.io.IOException
- Changes the read only attribute of the integrated file system object
represented by this object.
- Parameters:
attribute
- True to set the read only attribute of the file such that
the file cannot be changed. False to set the read only
attributes such that the file can be changed.- Returns:
- true if successful; false otherwise.
- Throws:
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ExtendedIOException - If an error occurs while communicating with the AS/400.
- java.io.InterruptedIOException - If this thread is interrupted.
- ServerStartupException - If the AS/400 server cannot be started.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
setSystem
public void setSystem(AS400 system)
throws java.beans.PropertyVetoException
- Sets the system.
The system cannot be changed once a connection is made to the server.
- Parameters:
system
- The AS/400 system object.- Throws:
- java.beans.PropertyVetoException - If the change is vetoed.
toString
public java.lang.String toString()
- Generates a String representation of this object.
- Overrides:
- toString in class java.lang.Object
- Returns:
- The path name of the integrated file system object represented by this object.