ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzahh_5.4.0.1/ifsfile.htm

77 lines
5.8 KiB
HTML
Raw Permalink Normal View History

2024-04-02 14:02:31 +00:00
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="security" content="public" />
<meta name="Robots" content="index,follow" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta name="DC.Type" content="reference" />
<meta name="DC.Title" content="IFSFile class" />
<meta name="abstract" content="The IFSFile class represents an object in the iSeries integrated file system." />
<meta name="description" content="The IFSFile class represents an object in the iSeries integrated file system." />
<meta name="copyright" content="(C) Copyright IBM Corporation 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="ifsfile" />
<meta name="DC.Language" content="en-us" />
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
<link rel="stylesheet" type="text/css" href="./ic.css" />
<title>IFSFile class</title>
</head>
<body id="ifsfile"><a name="ifsfile"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">IFSFile class</h1>
<div><p>The IFSFile class represents an object in the iSeries™ integrated
file system. </p>
<div class="section"><p><a href="javadoc/com/ibm/as400/access/IFSFile.html#NAVBAR_TOP">IFSFile</a> </p>
<p>The methods on IFSFile represent operations
that are done on the object as a whole. You can use IFSFileInputStream, IFSFileOutputStream,
and IFSRandomAccessFile to read and write to the file. The IFSFile class
allows the Java™ program to do the following:</p>
<ul><li>Determine if the object <a href="javadoc/com/ibm/as400/access/IFSFile.html#EXISTS()">exists</a> and is a <a href="javadoc/com/ibm/as400/access/IFSFile.html#ISDIRECTORY()">directory</a> or a <a href="javadoc/com/ibm/as400/access/IFSFile.html#ISFILE()">file</a></li>
<li>Determine if the Java program can <a href="javadoc/com/ibm/as400/access/IFSFile.html#CANREAD()">read from</a> or <a href="javadoc/com/ibm/as400/access/IFSFile.html#CANWRITE()">write to</a> a file</li>
<li>Determine the <a href="javadoc/com/ibm/as400/access/IFSFile.html#LENGTH()">length</a> of a file</li>
<li>Determine the <a href="javadoc/com/ibm/as400/access/IFSFile.html#GETPERMISSION()">permissions</a> of an object and <a href="javadoc/com/ibm/as400/access/IFSFile.html#SETPERMISSION(COM.IBM.AS400.ACCESS.PERMISSION)"> set</a> the permissions of an object</li>
<li><a href="javadoc/com/ibm/as400/access/IFSFile.html#MKDIR()">Create</a> a directory</li>
<li><a href="javadoc/com/ibm/as400/access/IFSFile.html#DELETE()">Delete</a> a file or directory</li>
<li><a href="javadoc/com/ibm/as400/access/IFSFile.html#RENAMETO(COM.IBM.AS400.ACCESS.IFSFILE)">Rename</a> a file or directory</li>
<li><a href="javadoc/com/ibm/as400/access/IFSFile.html#LASTMODIFIED()">Get</a> or <a href="javadoc/com/ibm/as400/access/IFSFile.html#SETLASTMODIFIED(LONG)">set</a> the last modification date of a file</li>
<li><a href="javadoc/com/ibm/as400/access/IFSFile.html#LIST()">List</a> the contents of a directory</li>
<li><a href="javadoc/com/ibm/as400/access/IFSFile.html#LISTFILES()">List</a> the contents of a directory and save the attribute
information to a local cache</li>
<li>Determine the amount of <a href="javadoc/com/ibm/as400/access/IFSFile.html#GETFREESPACE()">space available</a> on the system</li>
<li>Determine the <a href="javadoc/com/ibm/as400/access/IFSFile.html#GETSUBTYPE()">type of the file object</a> when it is in the QSYS.LIB file
system</li>
</ul>
<div class="p" id="ifsfile__listfiles2829method"><a name="ifsfile__listfiles2829method"><!-- --></a>You can get the list of files in a directory
by using either the <a href="javadoc/com/ibm/as400/access/IFSFile.html#LIST()">list() method</a> or the <a href="javadoc/com/ibm/as400/access/IFSFile.html#LISTFILES()">listFiles() method</a>:<ul><li>The listFiles() method caches information for each file on the initial
call. After calling listFiles(), using other methods to query file details
results in better performance because the information is retrieved from the
cache. For example, calling isDirectory() on an IFSFile object returned from
listFiles() does not require a call to the server.</li>
<li>The list() method retrieves information about each file in a separate
request to the server, making it slower and more demanding of server resources.</li>
</ul>
<div class="note"><span class="notetitle">Note:</span> Using listFiles() means that the information in the cache may
eventually become stale, so you may need to refresh the data by calling listFiles()
again.</div>
</div>
</div>
<div class="section"><h4 class="sectiontitle">Examples</h4><p>The following examples show how to use
the IFSFile class:</p>
<ul><li><a href="ifsfileexamples.htm#ifsfileexamples__creatingadirectory">Example: Creating a directory</a></li>
<li><a href="ifsfileexamples.htm#ifsfileexamples__trackingerrors">Example: Using IFSFile exceptions to track errors</a></li>
<li><a href="ifsfileexamples.htm#ifsfileexamples__listingtxtfiles">Example: Listing files with a .txt extension</a></li>
<li><a href="ifslistfilezexample.htm#ifslistfilezexample">Example: Using the IFSFile listFiles() method to list the contents of a directory</a></li>
</ul>
</div>
</div>
</body>
</html>