76 lines
4.4 KiB
HTML
76 lines
4.4 KiB
HTML
<?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="IFSFileOutputStream class" />
|
|
<meta name="abstract" content="The IFSFileOutputStream class represents an output stream for writing data to a file on the server." />
|
|
<meta name="description" content="The IFSFileOutputStream class represents an output stream for writing data to a file on the server." />
|
|
<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="ifsfos" />
|
|
<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>IFSFileOutputStream class</title>
|
|
</head>
|
|
<body id="ifsfos"><a name="ifsfos"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">IFSFileOutputStream class</h1>
|
|
<div><p>The IFSFileOutputStream class represents an output stream for writing
|
|
data to a file on the server.</p>
|
|
<div class="section"><p><a href="javadoc/com/ibm/as400/access/IFSFileOutputStream.html#NAVBAR_TOP"> IFSFileOutputStream</a> </p>
|
|
<p>As in the IFSFile class,
|
|
methods exist in IFSFileOutputStream that duplicate the methods in FileOutputStream
|
|
from the java.io package. IFSFileOutputStream also has additional methods
|
|
specific to the server. The IFSFileOutputStream class allows a Java™ program
|
|
to do the following:</p>
|
|
<ul><li><a href="javadoc/com/ibm/as400/access/IFSFileOutputStream.html#CONSTRUCTOR_DETAIL"> Open</a> a file for writing. If the file already exists,
|
|
it is replaced. Constructors are available that specify the file sharing mode
|
|
and whether the contents of an existing file have been appended.</li>
|
|
<li><a href="javadoc/com/ibm/as400/access/IFSFileOutputStream.html#WRITE(INT)"> Write</a> bytes to the stream.</li>
|
|
<li><a href="javadoc/com/ibm/as400/access/IFSFileOutputStream.html#FLUSH()"> Commit</a> to disk the bytes that are written to the stream.</li>
|
|
<li><a href="javadoc/com/ibm/as400/access/IFSFileOutputStream.html#LOCK(INT)"> Lock</a> or <a href="javadoc/com/ibm/as400/access/IFSFileOutputStream.html#UNLOCK(COM.IBM.AS400.ACCESS.IFSKEY)"> unlock</a> bytes in the stream.</li>
|
|
<li><a href="javadoc/com/ibm/as400/access/IFSFileOutputStream.html#CLOSE()"> Close</a> the file.</li>
|
|
</ul>
|
|
<p>As in FileOutputStream in java.io, this class allows a Java program
|
|
to sequentially write a stream of bytes to the file.</p>
|
|
<p>In addition to
|
|
the methods in FileOutputStream, IFSFileOutputStream gives the Java program
|
|
the following options:</p>
|
|
<ul><li>Locking and unlocking bytes in the stream. See <a href="ifskey.htm#ifskey">IFSKey</a> for
|
|
more information.</li>
|
|
<li>Specifying a sharing mode when the file is opened. See <a href="ifsmode.htm#ifsmode">sharing
|
|
modes</a> for more information.</li>
|
|
</ul>
|
|
</div>
|
|
<div class="section"><h4 class="sectiontitle">Example: Using IFSFileOutputStream</h4><p>The following
|
|
example shows how to use the IFSFileOutputStream class:</p>
|
|
<pre> // Create an AS400 object
|
|
AS400 sys = new AS400("mySystem.myCompany.com");
|
|
|
|
// Open a file object that
|
|
// represents the file.
|
|
IFSFileOutputStream aFile = new IFSFileOutputStream(sys,"/mydir1/mydir2/myfile");
|
|
|
|
// Write to the file
|
|
byte i = 123;
|
|
aFile.write(i);
|
|
|
|
// Close the file.
|
|
aFile.close();</pre>
|
|
</div>
|
|
</div>
|
|
|
|
</body>
|
|
</html> |