public class IFSFile extends Object implements Serializable, Comparable
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 for invalid symbolic links, both isFile
and
isDirectory
will return false.
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 named MYSYSTEM. AS400 as400 = new AS400("MYSYSTEM"); 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."); }
Note: Because of a host server restriction, you cannot use this class to access files in QTEMP.LIB.
Note: Support for "large files" (files larger than 2 gigabytes) was added to the File Server in IBM i V6R1, and was not PTF'd back to prior IBM i versions. The Toolbox's IFS classes rely on the File Server to access and manipulate files in the integrated file system.
Note on the use of IFS classes when accessing QSYS files:
The IFS classes are of limited usefulness when accessing formatted
file objects under QSYS, such as physical files and save files.
The IFS classes perform their work via datastream
requests that are sent to the "File Server" job on the IBM i system.
The File Server has its own idea of what is a "file" versus a "directory".
In the case of a QSYS file object that contains records and/or members,
the File Server tends to view such an object as a composite "directory"
rather than a flat data "file" (since the File Server wouldn't be free to just
start reading/writing bytes of data from/to the file at whatever offset,
without ending up with meaningless or corrupted data).
The File Server has no awareness of, or respect for, file record structure.
When accessing QSYS file objects, consider the use of other classes such as
SequentialFile
, KeyedFile
, and
SaveFile
.
Modifier and Type | Field and Description |
---|---|
static 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 int |
PATTERN_OS2
Value for indicating that "OS/2" pattern-matching is used by the various list() and listFiles() methods.
|
static int |
PATTERN_POSIX
Value for indicating that "POSIX" pattern-matching is used by the various list() and listFiles() methods.
|
static int |
PATTERN_POSIX_ALL
Value for indicating that "POSIX-all" pattern-matching is used by the various list() and listFiles() methods.
|
static 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 and Description |
---|
IFSFile()
Constructs an IFSFile object.
|
IFSFile(AS400 system,
IFSFile directory,
String name)
Constructs an IFSFile object.
|
IFSFile(AS400 system,
IFSJavaFile directory,
String name)
Constructs an IFSFile object.
|
IFSFile(AS400 system,
String path)
Constructs an IFSFile object.
|
IFSFile(AS400 system,
String directory,
String name)
Constructs an IFSFile object.
|
IFSFile(IFSFile directory,
String name)
Creates a new IFSFile instance from a parent abstract pathname and a child pathname string.
|
Modifier and Type | Method and Description |
---|---|
void |
addFileListener(FileListener listener)
Adds a file listener to receive file events from this IFSFile.
|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Adds a property change listener.
|
void |
addVetoableChangeListener(VetoableChangeListener listener)
Adds a vetoable change listener.
|
boolean |
canExecute()
Determines if the application is allowed to execute the integrated file system
object represented by this object.
|
boolean |
canRead()
Determines if the application can read from the integrated file system
object represented by this object.
|
boolean |
canWrite()
Determines if the application can write to the integrated file system
object represented by this object.
|
void |
clearCachedAttributes()
Clear the cached attributes.
|
int |
compareTo(Object obj)
Compares the path of this IFSFile with an
Object 's path. |
boolean |
copyTo(String path)
Copies this file or directory to the specified file or directory
on the system.
|
long |
created()
Determines the time that the integrated file system object represented by this
object was created.
|
boolean |
createNewFile()
Atomically creates a new, empty file named by this abstract pathname if and only if a file with this name does not yet exist.
|
boolean |
delete()
Deletes the integrated file system object represented by this object.
|
Enumeration |
enumerateFiles()
Lists the integrated file system objects in the directory represented by this
object.
|
Enumeration |
enumerateFiles(IFSFileFilter filter)
Lists the integrated file system objects in the directory represented by this
object that satisfy filter.
|
Enumeration |
enumerateFiles(IFSFileFilter filter,
String pattern)
Lists the integrated file system objects in the directory represented by this
object that satisfy filter.
|
Enumeration |
enumerateFiles(String pattern)
Lists the integrated file system objects in the directory represented by this
object.
|
boolean |
equals(Object obj)
Determines if two IFSFile objects are equal.
|
boolean |
exists()
Determines if the integrated file system object represented by this object exists.
|
String |
getAbsolutePath()
Returns the path name of the integrated file system object represented by
this object.
|
int |
getASP()
Return the auxiliary storage pool (ASP) that holds the object.
|
String |
getCanonicalPath()
Returns the canonical pathname string of the integrated file system
object represented by this object.
|
int |
getCCSID()
Returns the file's data CCSID.
|
String |
getFileSystem()
Returns the full path of the object.
|
long |
getFreeSpace()
Returns the amount of unused storage space that is available to the user.
|
static long |
getFreeSpace(AS400 system)
Returns the amount of unused storage space that is available to the user.
|
String |
getName()
Determines the name of the integrated file system object represented by this object.
|
int |
getOwnerId()
Deprecated.
Use getOwnerUID() instead.
|
String |
getOwnerName()
Returns the name of the user profile that is the owner of the file.
|
long |
getOwnerUID()
Returns the "user ID number" of the owner of the integrated file system file.
|
String |
getParent()
Returns the path of the parent directory of the integrated file system object
represented by this object.
|
IFSFile |
getParentFile()
Returns the parent directory of the current object.
|
String |
getPath()
Returns the path of the integrated file system object represented by this object.
|
String |
getPathPointedTo()
Returns the path of the integrated file system object that is directly pointed to by the symbolic link represented by this object; or null if the file is not a symbolic link or does not exist.
|
int |
getPatternMatching()
Returns the pattern-matching behavior used when files are listed by any of the list() or listFiles() methods.
|
Permission |
getPermission()
Returns the permission of the object.
|
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.
|
boolean |
isFile()
Determines if the integrated file system object represented by this object is a
"normal" file.
|
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.
|
boolean |
isSorted()
Returns the sorting behavior used when files are listed by any of the list() or listFiles() methods.
|
boolean |
isSourcePhysicalFile()
Determines if the file is an IBM i "source physical file".
|
boolean |
isSymbolicLink()
Determines if the integrated file system object represented by this object is a
symbolic link.
|
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.
|
String[] |
list()
Lists the integrated file system objects in the directory represented by this object.
|
String[] |
list(IFSFileFilter filter)
Lists the integrated file system objects in the directory represented by this
object that satisfy filter.
|
String[] |
list(IFSFileFilter filter,
String pattern)
Lists the integrated file system objects in the directory represented by this
object that satisfy filter.
|
String[] |
list(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 that satisfy filter.
|
IFSFile[] |
listFiles(IFSFileFilter filter,
String pattern)
Lists the integrated file system objects in the directory represented by this object that satisfy filter.
|
IFSFile[] |
listFiles(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(PropertyChangeListener listener)
Removes a property change listener.
|
void |
removeVetoableChangeListener(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 |
setCCSID(int ccsid)
Sets the file's data CCSID.
|
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 |
setLastModifiedV(long time)
Beans friendly version of setLastModified.
|
boolean |
setLength(int length)
Sets the length of the integrated file system object represented by this object.
|
void |
setPath(String path)
Sets the file path.
|
void |
setPatternMatching(int patternMatching)
Sets the pattern-matching behavior used when files are listed by any of the list() or listFiles() methods.
|
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 |
setSorted(boolean sort)
Sets the sorting behavior used when files are listed by any of the list() or listFiles() methods.
|
void |
setSystem(AS400 system)
Sets the system.
|
String |
toString()
Generates a String representation of this object.
|
public static final String pathSeparator
public static final char pathSeparatorChar
public static final String separator
public static final char separatorChar
public static final int PATTERN_POSIX
public static final int PATTERN_POSIX_ALL
Using POSIX semantics, all files are listed that match the pattern, including those that begin with a period.
public static final int PATTERN_OS2
public IFSFile()
public IFSFile(AS400 system, IFSFile directory, String name)
system
- The system that contains the file.directory
- The directory.name
- The file name.public IFSFile(AS400 system, String path)
system
- The system that contains the file.path
- The absolute path name of the file.public IFSFile(AS400 system, String directory, String name)
system
- The system that contains the file.directory
- The directory path name.name
- The file name.public IFSFile(AS400 system, IFSJavaFile directory, String name)
system
- The system that contains the file.directory
- The directory.name
- The file name.public IFSFile(IFSFile directory, String name)
The directory argument cannot be null. The constructed IFSFile instance uses the following settings taken from directory:
directory
- The directory where the IFSFile is or will be stored.name
- The name of the IFSFile object.public void addFileListener(FileListener listener)
listener
- The file listener.public void addPropertyChangeListener(PropertyChangeListener listener)
listener
- The property change listener to add.public void addVetoableChangeListener(VetoableChangeListener listener)
listener
- The vetoable change listener to add.public boolean canExecute() throws IOException
ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
public boolean canRead() throws IOException
ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
public boolean canWrite() throws IOException
ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
public void clearCachedAttributes()
listFiles()
public int compareTo(Object obj)
Object
's path.
If the other object is not an IFSFile or java.io.File,
this method throws a ClassCastException
, since
IFSFile is comparable only to IFSFile and java.io.File.
Note:
The comparison is case sensitive.
compareTo
in interface Comparable
obj
- The Object
to be compared.0
if this IFSFile path equals the argument's path;
a value less than 0
if this IFSFile path is less than the argument's
path; and a value greater than 0
if this IFSFile path is greater
than the argument's path.public boolean copyTo(String path) throws IOException, AS400SecurityException, ObjectAlreadyExistsException
path
- The destination path to copy this IFSFile to.
IOException
AS400SecurityException
ObjectAlreadyExistsException
public long created() throws IOException
ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
public boolean createNewFile() throws IOException
ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
- If the user is not authorized to create the file.public boolean delete() throws IOException
ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
public Enumeration enumerateFiles(IFSFileFilter filter, String pattern) throws IOException
filter
- A file object filter.pattern
- The pattern that all filenames must match. Acceptable
characters are wildcards (*) and question marks (?).ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system, or the directory is not accessible.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
public Enumeration enumerateFiles(String pattern) throws IOException
pattern
- The pattern that all filenames must match. Acceptable
characters are wildcards (*) and question marks (?).ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system, or the directory is not accessible.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
public Enumeration enumerateFiles(IFSFileFilter filter) throws IOException
filter
- A file object filter.ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system, or the directory is not accessible.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
public Enumeration enumerateFiles() throws IOException
ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system, or the directory is not accessible.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
public boolean equals(Object obj)
public boolean exists() throws IOException
ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
public String getAbsolutePath()
public String getCanonicalPath()
public int getCCSID() throws IOException
IOException
- If an error occurs while communicating with the system.public String getFileSystem()
public long getFreeSpace() throws IOException
Long.MAX_VALUE
if the system reports "no maximum".ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
public static long getFreeSpace(AS400 system) throws IOException
system
- The system of interest.Long.MAX_VALUE
if the system reports "no maximum".ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
public String getName()
public String getOwnerName() throws IOException, AS400SecurityException
AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.InterruptedException
- If this thread is interrupted.IOException
- If an error occurs while communicating with the system.ExtendedIOException
- If the file does not exist.public long getOwnerUID() throws IOException
IOException
- If an error occurs while communicating with the system.public int getOwnerId() throws IOException
IOException
- If an error occurs while communicating with the system.public String getParent()
getParentFile()
public IFSFile getParentFile()
getParent()
public String getPath()
public String getPathPointedTo() throws IOException, AS400SecurityException
This method is not supported for files in the following file systems:
AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.InterruptedException
- If this thread is interrupted.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.public int getPatternMatching() throws IOException
PATTERN_POSIX
, PATTERN_POSIX_ALL
, or PATTERN_OS2
IOException
setPatternMatching(int)
public Permission getPermission() throws AS400Exception, AS400SecurityException, ConnectionDroppedException, ErrorCompletingRequestException, InterruptedException, ObjectDoesNotExistException, IOException, UnsupportedEncodingException
AS400Exception
- If the 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.InterruptedException
- If this thread is interrupted.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.UnknownHostException
- If the system cannot be located.UnsupportedEncodingException
setPermission(com.ibm.as400.access.Permission)
public String getSubtype() throws IOException, AS400SecurityException
ExtendedIOException
- If an error occurs while communicating with the system.AS400SecurityException
- If a security or authority error occurs.IOException
public boolean isSourcePhysicalFile() throws AS400Exception, AS400SecurityException, IOException
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.IOException
- If an error occurs while communicating with the system.AS400File.TYPE_SOURCE
,
AS400File.TYPE_DATA
public AS400 getSystem()
public int getASP() throws IOException, AS400SecurityException
IOException
AS400SecurityException
public int hashCode()
public boolean isAbsolute()
public boolean isDirectory() throws IOException
isFile
will return false
for invalid symbolic links.ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
public boolean isFile() throws IOException
isDirectory
and isFile() will return false
for invalid symbolic links.ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
isSymbolicLink()
public boolean isHidden() throws IOException, AS400SecurityException
AS400SecurityException
- If a security or authority error occurs.ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
public boolean isSymbolicLink() throws IOException, AS400SecurityException
isDirectory
and isFile
resolve symbolic links to their ultimate destination. For example, if this object represents a symbolic link on the system, that resolves to a file object, then isSymbolicLink() will return true, isFile() will return true, and isDirectory() will return false.
ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
AS400SecurityException
public boolean isReadOnly() throws IOException, AS400SecurityException
AS400SecurityException
- If a security or authority error occurs.ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
public boolean isSorted() throws IOException
IOException
public long lastAccessed() throws IOException
listFiles
methods, attribute
information is cached and will not be automatically refreshed from the system.
This means the reported last accessed time may become inconsistent with the system.ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
public long lastModified() throws IOException
listFiles
methods, attribute
information is cached and will not be automatically refreshed from the system.
This means the reported last modified time may become inconsistent with the system.ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
public long length() throws IOException
listFiles
methods, attribute
information is cached and will not be automatically refreshed from the system.
This means the reported length may become inconsistent with the system.listFiles
or
enumerateFiles
methods (for symbolic link objects)
this method will return the length of the symbolic link object as returned by the File Server.
In order to retrieve the length of the target object, you must use
clearCachedAttributes()
followed by length()
.ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
public String[] list() throws IOException
ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system, or the directory is not accessible.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
listFiles()
,
setPatternMatching(int)
public String[] list(IFSFileFilter filter) throws IOException
filter
- A file object filter. If null, then no filtering is done.ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system or the directory is not accessible.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
listFiles(IFSFileFilter)
,
setPatternMatching(int)
public String[] list(IFSFileFilter filter, String pattern) throws IOException
filter
- A file object filter.pattern
- The pattern that all filenames must match. Acceptable characters
are wildcards (*) and
question marks (?).ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system or the directory is not accessible.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
listFiles(IFSFileFilter,String)
,
setPatternMatching(int)
public String[] list(String pattern) throws IOException
pattern
- The pattern that all filenames must match. Acceptable
characters are wildcards (*) and
question marks (?).ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system, or the directory is not accessible.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
listFiles(String)
,
setPatternMatching(int)
public IFSFile[] listFiles() throws IOException
list
method, but attribute information may become inconsistent with the system.
When the IFSFile object represents the root of the QSYS file system, this method may return a partial list of the contents of the directory.
ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system, or the directory is not accessible.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
setPatternMatching(int)
public IFSFile[] listFiles(IFSFileFilter filter) throws IOException
list
method, but attribute information may become inconsistent with the system.
When the IFSFile object represents the root of the QSYS file system, this method may return a partial list of the contents of the directory.
filter
- A file object filter.ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system, or the directory is not accessible.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
setPatternMatching(int)
public IFSFile[] listFiles(IFSFileFilter filter, String pattern) throws IOException
list
method, but attribute information may become inconsistent with the system.
When pattern
is "*" and the IFSFile object represents the root of the QSYS file system, this method may return a partial list of the contents of the directory.
filter
- A file object filter.pattern
- The pattern that all filenames must match. Acceptable
characters are wildcards (*) and
question marks (?).ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system, or the directory is not accessible.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
setPatternMatching(int)
public IFSFile[] listFiles(String pattern) throws IOException
list
method, but attribute information may become inconsistent with the system.
When pattern
is "*" and the IFSFile object represents the root of the QSYS file system, this method may return a partial list of the contents of the directory.
pattern
- The pattern that all filenames must match. Acceptable characters
are wildcards (*) and
question marks (?).ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system, or the directory is not accessible.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
setPatternMatching(int)
public boolean mkdir() throws IOException
ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
public boolean mkdirs() throws IOException
ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
public void removeFileListener(FileListener listener)
listener
- The file listener.public void removePropertyChangeListener(PropertyChangeListener listener)
listener
- The property change listener to remove.public void removeVetoableChangeListener(VetoableChangeListener listener)
listener
- The vetoable change listener to remove.public boolean renameTo(IFSFile file) throws IOException, PropertyVetoException
file
- The new file name.ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system.InterruptedIOException
- If this thread is interrupted.PropertyVetoException
- If the change is vetoed.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
public boolean setCCSID(int ccsid) throws IOException
ccsid
- The file data CCSID. Note that the data in the file is not changed; only the CCSID "tag" on the file is changed.ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system, or if the file doesn't exist or is a directory.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
public boolean setHidden() throws IOException
ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
public boolean setHidden(boolean attribute) throws IOException
attribute
- True to set the hidden attribute of the file.
False to turn off the hidden attribute.ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
public boolean setLastModified(long time) throws IOException, PropertyVetoException
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, or -1 to set the last modification time to the current system time.ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.PropertyVetoException
- If the change is vetoed.IOException
public void setLastModifiedV(long time) throws IOException, PropertyVetoException
time
- IOException
PropertyVetoException
public boolean setLength(int length) throws IOException
length
- The new length, in bytes.ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
public void setPath(String path) throws PropertyVetoException
path
- The absolute file path.PropertyVetoException
- If the change is vetoed.public void setPatternMatching(int patternMatching) throws IOException
patternMatching
- Either PATTERN_POSIX
, PATTERN_POSIX_ALL
, or PATTERN_OS2
ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
getPatternMatching()
public void setPermission(Permission permission) throws AS400Exception, AS400SecurityException, ConnectionDroppedException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException, ServerStartupException, PropertyVetoException, UnknownHostException
permission
- The permission that will be set to the object.AS400Exception
- If the 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.InterruptedException
- If this thread is interrupted.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.PropertyVetoException
- If the change is vetoed.UnknownHostException
- If the system cannot be located.ServerStartupException
getPermission()
public boolean setReadOnly() throws IOException
ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
public boolean setReadOnly(boolean attribute) throws IOException
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.ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.UnknownHostException
- If the system cannot be located.IOException
public void setSorted(boolean sort) throws IOException, AS400SecurityException
sort
- If true: Lists of files are returned in sorted order.
If false: Lists of files are returned in whatever order the file system provides.IOException
- If an error occurs while communicating with the system.AS400SecurityException
- If a security or authority error occurs.public void setSystem(AS400 system) throws PropertyVetoException
system
- The system object.PropertyVetoException
- If the change is vetoed.