Class IFSFile
- java.lang.Object
-
- com.ibm.as400.access.IFSFile
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Comparable
public class IFSFile extends java.lang.Object implements java.io.Serializable, java.lang.Comparable
Represents an object in the IBM i integrated file system. As injava.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. UseIFSFileInputStream
orIFSRandomAccessFile
to read data from the file, andIFSFileOutputStream
orIFSRandomAccessFile
to write data to the file. Note that for invalid symbolic links, bothisFile
andisDirectory
will return false.IFSFile objects are capable of generating file events that call the following
FileListener
methods:fileDeleted()
andfileModified()
.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 asSequentialFile
,KeyedFile
, andSaveFile
.
-
-
Field Summary
Fields Modifier and Type Field and Description 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 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 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
Constructors Constructor and Description 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.IFSFile(IFSFile directory, java.lang.String name)
Creates a new IFSFile instance from a parent abstract pathname and a child pathname string.
-
Method Summary
Methods Modifier and Type Method and Description 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
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(java.lang.Object obj)
Compares the path of this IFSFile with anObject
's path.boolean
copyTo(java.lang.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.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 canonical pathname string of the integrated file system object represented by this object.int
getCCSID()
Returns the file's data CCSID.java.lang.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.java.lang.String
getName()
Determines the name of the integrated file system object represented by this object.int
getOwnerId()
Deprecated.Use getOwnerUID() instead.java.lang.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.java.lang.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.java.lang.String
getPath()
Returns the path of the integrated file system object represented by this object.java.lang.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.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.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.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 that satisfy filter.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
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.boolean
setLength(int length)
Sets the length of the integrated file system object represented by this object.void
setPath(java.lang.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.java.lang.String
toString()
Generates a String representation of this object.
-
-
-
Field Detail
-
pathSeparator
public static final java.lang.String pathSeparator
The integrated file system path separator string used to separate paths in a path list.- See Also:
- Constant Field Values
-
pathSeparatorChar
public static final char pathSeparatorChar
The integrated file system path separator character used to separate paths in a path list.- See Also:
- Constant Field Values
-
separator
public static final java.lang.String separator
The integrated file system directory separator string used to separate directory/file components in a path.- See Also:
- Constant Field Values
-
separatorChar
public static final char separatorChar
The integrated file system directory separator character used to separate directory/file components in a path.- See Also:
- Constant Field Values
-
PATTERN_POSIX
public static final int PATTERN_POSIX
Value for indicating that "POSIX" pattern-matching is used by the various list() and listFiles() methods.
Using POSIX semantics, all files are listed that match the pattern and do not begin with a period (unless the pattern begins with a period). In that case, names beginning with a period are also listed. Note that when no pattern is specified, the default pattern is "*".
Note: In OS/400 V5R1 and earlier, all files that match the pattern are listed, including those that begin with a period.- See Also:
- Constant Field Values
-
PATTERN_POSIX_ALL
public static final int PATTERN_POSIX_ALL
Value for indicating that "POSIX-all" pattern-matching is used by the various list() and listFiles() methods.Using POSIX semantics, all files are listed that match the pattern, including those that begin with a period.
- See Also:
- Constant Field Values
-
PATTERN_OS2
public static final int PATTERN_OS2
Value for indicating that "OS/2" pattern-matching is used by the various list() and listFiles() methods. Using DOS semantics, all files are listed that match the pattern.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
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 system 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 system that contains the file.path
- The absolute path name of the file.
-
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 system that contains the file.directory
- 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 system that contains the file.directory
- The directory.name
- The file name.
-
IFSFile
public IFSFile(IFSFile directory, java.lang.String name)
Creates a new IFSFile instance from a parent abstract pathname and a child pathname string.The directory argument cannot be null. The constructed IFSFile instance uses the following settings taken from directory:
- system
- path
- Parameters:
directory
- The directory where the IFSFile is or will be stored.name
- The name of the IFSFile object.
-
-
Method Detail
-
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.
-
canExecute
public boolean canExecute() throws java.io.IOException
Determines if the application is allowed to execute the integrated file system object represented by this object. This method is supported for IBM i V5R1 and higher. For older releases, it simply returns false. If the user profile has *ALLOBJ special authority (and system is V5R1 or higher), this method always returns true.- Returns:
- true if the object exists and is executable by the application; false otherwise.
- Throws:
ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
-
canRead
public boolean canRead() throws java.io.IOException
Determines if the application can read from the integrated file system object represented by this object. Note that IBM i directories are never readable; only files can be readable.- Returns:
- true if the object exists and is readable by the application; false otherwise.
- Throws:
ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
-
canWrite
public boolean canWrite() throws java.io.IOException
Determines if the application can write to the integrated file system object represented by this object. Note that IBM i directories are never writable; only files can be writable.- Returns:
- true if the object exists and is writeable by the application; false otherwise.
- Throws:
ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
-
clearCachedAttributes
public void clearCachedAttributes()
Clear the cached attributes. This is needed when cached attributes need to be refreshed.- See Also:
listFiles()
-
compareTo
public int compareTo(java.lang.Object obj)
Compares the path of this IFSFile with anObject
's path. If the other object is not an IFSFile or java.io.File, this method throws aClassCastException
, since IFSFile is comparable only to IFSFile and java.io.File.Note:
The comparison is case sensitive.- Specified by:
compareTo
in interfacejava.lang.Comparable
- Parameters:
obj
- TheObject
to be compared.- Returns:
0
if this IFSFile path equals the argument's path; a value less than0
if this IFSFile path is less than the argument's path; and a value greater than0
if this IFSFile path is greater than the argument's path.
-
copyTo
public boolean copyTo(java.lang.String path) throws java.io.IOException, AS400SecurityException, ObjectAlreadyExistsException
Copies this file or directory to the specified file or directory on the system. If the destination file already exists, it is overwritten. If this IFSFile represents a directory:- The destination directory must be nonexistent, otherwise an exception is thrown.
- The entire directory (including all of its contents and subdirectories) is copied.
- Parameters:
path
- The destination path to copy this IFSFile to.
If the system is V5R2 or earlier: If the current object is a file (rather than a directory), the destination path must also specify a file (rather than a directory), otherwise the copy may fail.- Returns:
- true if the copy succeeded (or at least one file of a source directory's contents was copied); false otherwise.
- Throws:
java.io.IOException
AS400SecurityException
ObjectAlreadyExistsException
-
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 system.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
-
createNewFile
public boolean createNewFile() throws java.io.IOException
Atomically creates a new, empty file named by this abstract pathname if and only if a file with this name does not yet exist. The check for the existence of the file and the creation of the file if it does not exist are a single operation that is atomic with respect to all other filesystem activities that might affect the file. If the file already exists, its data are left intact.- Returns:
- true if the named file does not exist and was successfully created; false if the named file already exists.
- Throws:
ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
- If the user is not authorized to create the file.
-
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 system.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
-
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, or the filter or pattern does not match any files, 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 system, or the directory is not accessible.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
-
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, or the pattern does not match any files, then an empty Enumeration is returned.
- Throws:
ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system, or the directory is not accessible.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
-
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, or the filter does not match any files, 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 system, or the directory is not accessible.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
-
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, or the filter or pattern does not match any files, then an empty Enumeration is returned.
- Throws:
ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system, or the directory is not accessible.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
-
equals
public boolean equals(java.lang.Object obj)
Determines if two IFSFile objects are equal.- Overrides:
equals
in classjava.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 system.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
-
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 canonical pathname string of the integrated file system object represented by this object. This is the full path starting at the root directory. This typically involves removing redundant names such as "." and ".." from the pathname. Symbolic links are not resolved.- Returns:
- The canonical path name of this integrated file system object.
-
getCCSID
public int getCCSID() throws java.io.IOException
Returns the file's data CCSID. All files in the system'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.
- Throws:
java.io.IOException
- If an error occurs while communicating with the system.
-
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
Returns the amount of unused storage space that is available to the user.- Returns:
- The number of bytes of storage available to the user, or special value
Long.MAX_VALUE
if the system reports "no maximum". - Throws:
ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
-
getFreeSpace
public static long getFreeSpace(AS400 system) throws java.io.IOException
Returns the amount of unused storage space that is available to the user.- Parameters:
system
- The system of interest.- Returns:
- The number of bytes of storage available to the user, or special value
Long.MAX_VALUE
if the system reports "no maximum". - Throws:
ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
-
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).
-
getOwnerName
public java.lang.String getOwnerName() throws java.io.IOException, AS400SecurityException
Returns the name of the user profile that is the owner of the file.- Returns:
- The name of the user profile that owns the file, or "" if owner cannot be determined (for example, if the file is a directory).
- Throws:
AS400SecurityException
- If a security or authority error occurs.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 communicating with the system.ExtendedIOException
- If the file does not exist.
-
getOwnerUID
public long getOwnerUID() throws java.io.IOException
Returns the "user ID number" of the owner of the integrated file system file. If the file is non-existent or is a directory, returns -1.- Returns:
- The file owner's ID number.
- Throws:
java.io.IOException
- If an error occurs while communicating with the system.
-
getOwnerId
public int getOwnerId() throws java.io.IOException
Deprecated. Use getOwnerUID() instead.Returns the "user ID number" of the owner of the integrated file system file. If the file is non-existent or is a directory, returns -1.- Returns:
- The file owner's ID number.
- Throws:
java.io.IOException
- If an error occurs while communicating with the system.
-
getParent
public java.lang.String getParent()
Returns the path of 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.
- See Also:
getParentFile()
-
getParentFile
public IFSFile getParentFile()
Returns the parent directory of the current object. The parent is the path name before the last occurrence of the separator character. Null is returned if the separator character does not appear in the path, or if the current object is the file system root. If the system property is not yet set in the current object, then the system property will not be set in the returned object.- Returns:
- an IFSJavaFile object representing the parent directory if one exists; null otherwise.
- See Also:
getParent()
-
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.
-
getPathPointedTo
public java.lang.String getPathPointedTo() throws java.io.IOException, AS400SecurityException
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.This method is not supported for files in the following file systems:
- QSYS.LIB
- Independent ASP QSYS.LIB
- QDLS
- QOPT
- QNTC
- Returns:
- The path directly pointed to by the symbolic link, or null if the IFS object is not a symbolic link or does not exist. Depending on how the symbolic link was defined, the path may be either relative or absolute.
- Throws:
AS400SecurityException
- If a security or authority error occurs.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 communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
getPatternMatching
public int getPatternMatching() throws java.io.IOException
Returns the pattern-matching behavior used when files are listed by any of the list() or listFiles() methods. The default is PATTERN_POSIX.- Returns:
- Either
PATTERN_POSIX
,PATTERN_POSIX_ALL
, orPATTERN_OS2
- Throws:
java.io.IOException
- See Also:
setPatternMatching(int)
-
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 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 communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.java.net.UnknownHostException
- If the system cannot be located.java.io.UnsupportedEncodingException
- 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.
Note that many file system objects do not have a subtype: for example, .MBR objects, and any Root, QOpenSys or UDFS object.
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 system.AS400SecurityException
- If a security or authority error occurs.java.io.IOException
-
isSourcePhysicalFile
public boolean isSourcePhysicalFile() throws AS400Exception, AS400SecurityException, java.io.IOException
Determines if the file is an IBM i "source physical file". Physical files reside under QSYS, and can be either source files (type *SRC) or data files (type *DATA). For further information, refer to the specification of the QDBRTVFD (Retrieve Database File Description) API.- Returns:
- Whether the file is a source file.
- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.java.io.IOException
- If an error occurs while communicating with the system.- See Also:
AS400File.TYPE_SOURCE
,AS400File.TYPE_DATA
-
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 classjava.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.
Both isDirectory() andisFile
will return false for invalid symbolic links.- 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 system.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
-
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.
BothisDirectory
and isFile() will return false for invalid symbolic links.- 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 system.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
- See Also:
isSymbolicLink()
-
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 system.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
-
isSymbolicLink
public boolean isSymbolicLink() throws java.io.IOException, AS400SecurityException
Determines if the integrated file system object represented by this object is a symbolic link.
Note: BothisDirectory
andisFile
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.
Note: If the system is V5R2 or earlier, this method always returns false, regardless of whether the system object is a link or not.- Returns:
- true if the specified file exists and is a symbolic link; false otherwise.
If the system is V5R2 or earlier, this method always returns false. - Throws:
ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
AS400SecurityException
-
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 system.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
-
isSorted
public boolean isSorted() throws java.io.IOException
Returns the sorting behavior used when files are listed by any of the list() or listFiles() methods.- Returns:
- true if lists of files are returned in sorted order; false otherwise.
- Throws:
java.io.IOException
-
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 thelistFiles
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.- 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 system.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
-
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 thelistFiles
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.- 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 system.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
-
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 thelistFiles
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.- Returns:
- The length, in bytes, of the integrated file system object, or
0L if it does not exist or is not accessible.
Note: When used followinglistFiles
orenumerateFiles
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 useclearCachedAttributes()
followed bylength()
. - Throws:
ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
-
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, null is returned. If this object represents
an empty directory, an empty string array is returned.
Note: Due to a limitation in the File Server, at most 65,535 files will be listed. - Throws:
ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system, or the directory is not accessible.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
- See Also:
listFiles()
,setPatternMatching(int)
-
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, 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.
Note: Due to a limitation in the File Server, at most 65,535 files will be listed. - Throws:
ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system or the directory is not accessible.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
- See Also:
listFiles(IFSFileFilter)
,setPatternMatching(int)
-
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, 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.
Note: Due to a limitation in the File Server, at most 65,535 files will be listed. - Throws:
ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system or the directory is not accessible.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
- See Also:
listFiles(IFSFileFilter,String)
,setPatternMatching(int)
-
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, null is returned. If
this object represents an empty directory, or the pattern does not
match any files, an empty string array is returned.
Note: Due to a limitation in the File Server, at most 65,535 files will be listed. - Throws:
ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system, or the directory is not accessible.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
- See Also:
listFiles(String)
,setPatternMatching(int)
-
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 method, attribute information is cached and will not be automatically refreshed from the system. This means that retrieving attribute information for files returned in the list is much faster than using thelist
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.
- 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 this object represents
an empty directory, an empty object array is returned.
Note: Due to a limitation in the File Server, at most 65,535 files will be listed. - Throws:
ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system, or the directory is not accessible.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
- See Also:
setPatternMatching(int)
-
listFiles
public IFSFile[] listFiles(IFSFileFilter filter) 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 method, attribute information is cached and will not be automatically refreshed from the system. This means that retrieving attribute information for files returned in the list is much faster than using thelist
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.
- Parameters:
filter
- A file object filter.- 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 this
object represents an empty directory, an empty object array is returned.
Note: Due to a limitation in the File Server, at most 65,535 files will be listed. - Throws:
ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system, or the directory is not accessible.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
- See Also:
setPatternMatching(int)
-
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 method, attribute information is cached and will not be automatically refreshed from the system. This means that retrieving attribute information for files returned in the list is much faster than using thelist
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.- 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, 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.
Note: Due to a limitation in the File Server, at most 65,535 files will be listed. - Throws:
ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system, or the directory is not accessible.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
- See Also:
setPatternMatching(int)
-
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 method, attribute information is cached and will not be automatically refreshed from the system. This means that retrieving attribute information for files returned in the list is much faster than using thelist
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.- 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, this object
represents an empty directory, or the pattern does not match any files,
an empty object array is returned.
Note: Due to a limitation in the File Server, at most 65,535 files will be listed. - Throws:
ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system, or the directory is not accessible.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
- See Also:
setPatternMatching(int)
-
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 system.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
-
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 system.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
-
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 system.java.io.InterruptedIOException
- If this thread is interrupted.java.beans.PropertyVetoException
- If the change is vetoed.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
-
setCCSID
public boolean setCCSID(int ccsid) throws java.io.IOException
Sets the file's data CCSID.- Parameters:
ccsid
- The file data CCSID. Note that the data in the file is not changed; only the CCSID "tag" on the file is changed.- Returns:
- true if successful; false otherwise.
- Throws:
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.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
-
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 system.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
-
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 system.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
-
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, or -1 to set the last modification time to the current system time.- Returns:
- true if successful; false otherwise.
- Throws:
ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.beans.PropertyVetoException
- If the change is vetoed.java.io.IOException
-
setLength
public boolean setLength(int length) throws java.io.IOException
Sets the length of the integrated file system object represented by this object. The file can be made larger or smaller. If the file is made larger, the contents of the new bytes of the file are undetermined.- Parameters:
length
- The new length, in bytes.- Returns:
- true if successful; false otherwise.
- Throws:
ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
-
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.
-
setPatternMatching
public void setPatternMatching(int patternMatching) throws java.io.IOException
Sets the pattern-matching behavior used when files are listed by any of the list() or listFiles() methods. The default is PATTERN_POSIX.- Parameters:
patternMatching
- EitherPATTERN_POSIX
,PATTERN_POSIX_ALL
, orPATTERN_OS2
- Throws:
ConnectionDroppedException
- If the connection is dropped unexpectedly.ExtendedIOException
- If an error occurs while communicating with the system.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
- See Also:
getPatternMatching()
-
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 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 communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.java.beans.PropertyVetoException
- If the change is vetoed.java.net.UnknownHostException
- If the system cannot be located.ServerStartupException
- 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 system.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
-
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 system.java.io.InterruptedIOException
- If this thread is interrupted.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.java.io.IOException
-
setSorted
public void setSorted(boolean sort) throws java.io.IOException, AS400SecurityException
Sets the sorting behavior used when files are listed by any of the list() or listFiles() methods. The default is false (unsorted).- Parameters:
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.- Throws:
java.io.IOException
- If an error occurs while communicating with the system.AS400SecurityException
- If a security or authority error occurs.
-
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 system.- Parameters:
system
- The 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 classjava.lang.Object
- Returns:
- The path name of the integrated file system object represented by this object.
-
-