All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.as400.access.IFSTextFileOutputStream

java.lang.Object
   |
   +----java.io.OutputStream
           |
           +----com.ibm.as400.access.IFSFileOutputStream
                   |
                   +----com.ibm.as400.access.IFSTextFileOutputStream

public class IFSTextFileOutputStream
extends IFSFileOutputStream
The IFSTextFileOutputStream class represents an integrated file system output stream for character data.
IFSTextFileOutputStream object is capable of generating file events which call the following FileListener methods: fileClosed, fileModified, and fileOpened.
The following example illustrates the use of IFSTextFileOutputStream:
// Work with /File on the system eniac.
AS400 as400 = new AS400("eniac");
IFSTextFileOutputStream file = new IFSTextFileOutputStream(as400, "/File");
// Write a String to the file (don't convert characters). file.write("Hello world"); // Close the file. file.close();

See Also:
FileEvent, addFileListener, removeFileListener

Constructor Index

 o IFSTextFileOutputStream()
Constructs an IFSTextFileOutputStream object.
 o IFSTextFileOutputStream(AS400, IFSFile, int, boolean)
Constructs an IFSTextFileOutputStream object.
 o IFSTextFileOutputStream(AS400, IFSFile, int, boolean, int)
Constructs an IFSTextFileOutputStream object.
 o IFSTextFileOutputStream(AS400, IFSJavaFile, int, boolean)
Constructs an IFSTextFileOutputStream object.
 o IFSTextFileOutputStream(AS400, IFSJavaFile, int, boolean, int)
Constructs an IFSTextFileOutputStream object.
 o IFSTextFileOutputStream(AS400, String)
Constructs an IFSTextFileOutputStream object.
 o IFSTextFileOutputStream(AS400, String, int)
Constructs an IFSTextFileOutputStream object.
 o IFSTextFileOutputStream(AS400, String, int, boolean)
Constructs an IFSTextFileOutputStream object.
 o IFSTextFileOutputStream(AS400, String, int, boolean, int)
Constructs an IFSTextFileOutputStream object.
 o IFSTextFileOutputStream(IFSFileDescriptor)
Constructs an IFSTextFileOutputStream object.

Method Index

 o close()
Closes this text file output stream and releases any system resources associated with the stream.
 o finalize()
Ensures that the text file output stream is closed when there are no more references to it.
 o flush()
Forces any buffered output bytes to be written.
 o getCCSID()
Returns the CCSID.
 o setCCSID(int)
Sets the CCSID for the data written to the file.
 o write(String)
Writes characters to this text file input stream.

Constructors

 o IFSTextFileOutputStream
 public IFSTextFileOutputStream()
Constructs an IFSTextFileOutputStream object.

 o IFSTextFileOutputStream
 public IFSTextFileOutputStream(AS400 system,
                                String name) throws AS400SecurityException, IOException
Constructs an IFSTextFileOutputStream object. It creates a file output stream to write to the text file with the specified name. Other readers and writers are allowed to access the file. The file is replaced if it exists; otherwise the file is created. By default, Unicode data is written to the file.

Parameters:
system - The AS400 that contains the file.
name - The file to be opened for writing.
Throws: AS400SecurityException
If a security or authority error occurs.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: InterruptedIOException
If this thread is interrupted.
Throws: ExtendedIOException
If an error occurs while communicating with the AS/400.
Throws: ServerStartupException
If the AS/400 server cannot be started.
Throws: UnknownHostException
If the AS/400 system cannot be located.
 o IFSTextFileOutputStream
 public IFSTextFileOutputStream(AS400 system,
                                String name,
                                int ccsid) throws AS400SecurityException, IOException
Constructs an IFSTextFileOutputStream object. It creates a file output stream to write to the text file with the specified name and CCSID. Other readers and writers are allowed to access the file. The file is replaced if it exists; otherwise the file is created.

Parameters:
system - The AS400 that contains the file.
name - The file to be opened for writing.
ccsid - The CCSID of the data being written to the file.
Throws: AS400SecurityException
If a security or authority error occurs.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: InterruptedIOException
If this thread is interrupted.
Throws: ExtendedIOException
If an error occurs while communicating with the AS/400.
Throws: ServerStartupException
If the AS/400 server cannot be started.
Throws: UnknownHostException
If the AS/400 system cannot be located.
 o IFSTextFileOutputStream
 public IFSTextFileOutputStream(AS400 system,
                                String name,
                                int shareOption,
                                boolean append) throws AS400SecurityException, IOException
Constructs an IFSTextFileOutputStream object. It creates a file output stream to write to the text file with the specified name. By default, Unicode data is written to the file.

Parameters:
system - The AS400 that contains the file.
name - The file to be opened for writing.
shareOption - Indicates how other user's can access the file.
  • SHARE_ALL Share access with readers and writers
  • SHARE_NONE Share access with none
  • SHARE_READERS Share access with readers
  • SHARE_WRITERS Share access with writers
append - Controls the behavior when the file exists. If true output is appended to the file; otherwise the output replaces the file contents.
Throws: AS400SecurityException
If a security or authority error occurs.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: InterruptedIOException
If this thread is interrupted.
Throws: ExtendedIOException
If an error occurs while communicating with the AS/400.
Throws: ServerStartupException
If the AS/400 server cannot be started.
Throws: UnknownHostException
If the AS/400 system cannot be located.
 o IFSTextFileOutputStream
 public IFSTextFileOutputStream(AS400 system,
                                String name,
                                int shareOption,
                                boolean append,
                                int ccsid) throws AS400SecurityException, IOException
Constructs an IFSTextFileOutputStream object. It creates a file output stream to write to the text file with the specified name and CCSID.

Parameters:
system - The AS400 that contains the file.
name - The file to be opened for writing.
shareOption - Indicates how other user's can access the file.
  • SHARE_ALL Share access with readers and writers
  • SHARE_NONE Share access with none
  • SHARE_READERS Share access with readers
  • SHARE_WRITERS Share access with writers
append - Controls the behavior when the file exists. If true output is appended to the file; otherwise the output replaces the file contents.
ccsid - The CCSID of the data being written to the file.
Throws: AS400SecurityException
If a security or authority error occurs.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: InterruptedIOException
If this thread is interrupted.
Throws: ExtendedIOException
If an error occurs while communicating with the AS/400.
Throws: ServerStartupException
If the AS/400 server cannot be started.
Throws: UnknownHostException
If the AS/400 system cannot be located.
 o IFSTextFileOutputStream
 public IFSTextFileOutputStream(AS400 system,
                                IFSFile file,
                                int shareOption,
                                boolean append) throws AS400SecurityException, IOException
Constructs an IFSTextFileOutputStream object. It creates a file output stream to write to the text file specified by file. By default, Unicode data is written to the file.

Parameters:
system - The AS400 that contains the file.
file - The file to be opened for writing.
shareOption - Indicates how other user's can access the file.
  • SHARE_ALL Share access with readers and writers
  • SHARE_NONE Share access with none
  • SHARE_READERS Share access with readers
  • SHARE_WRITERS Share access with writers
append - Controls the behavior when the file exists. If true output is appended to the file; otherwise the output replaces the file contents.
Throws: AS400SecurityException
If a security or authority error occurs.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: InterruptedIOException
If this thread is interrupted.
Throws: ExtendedIOException
If an error occurs while communicating with the AS/400.
Throws: ServerStartupException
If the AS/400 server cannot be started.
Throws: UnknownHostException
If the AS/400 system cannot be located.
 o IFSTextFileOutputStream
 public IFSTextFileOutputStream(AS400 system,
                                IFSFile file,
                                int shareOption,
                                boolean append,
                                int ccsid) throws AS400SecurityException, IOException
Constructs an IFSTextFileOutputStream object. It creates a file output stream to write to the text file specified by file using the CCSID specified by ccsid.

Parameters:
system - The AS400 that contains the file.
file - The file to be opened for writing.
shareOption - Indicates how other user's can access the file.
  • SHARE_ALL Share access with readers and writers
  • SHARE_NONE Share access with none
  • SHARE_READERS Share access with readers
  • SHARE_WRITERS Share access with writers
append - Controls the behavior when the file exists. If true output is appended to the file; otherwise the output replaces the file contents.
ccsid - The CCSID of the data being written to the file.
Throws: AS400SecurityException
If a security or authority error occurs.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: InterruptedIOException
If this thread is interrupted.
Throws: ExtendedIOException
If an error occurs while communicating with the AS/400.
Throws: ServerStartupException
If the AS/400 server cannot be started.
Throws: UnknownHostException
If the AS/400 system cannot be located.
 o IFSTextFileOutputStream
 public IFSTextFileOutputStream(AS400 system,
                                IFSJavaFile file,
                                int shareOption,
                                boolean append) throws AS400SecurityException, IOException
Constructs an IFSTextFileOutputStream object. It creates a file output stream to write to the text file specified by file.

Parameters:
system - The AS400 that contains the file.
file - The file to be opened for writing.
shareOption - Indicates how other user's can access the file.
  • SHARE_ALL Share access with readers and writers
  • SHARE_NONE Share access with none
  • SHARE_READERS Share access with readers
  • SHARE_WRITERS Share access with writers
append - Controls the behavior when the file exists. If true output is appended to the file; otherwise the output replaces the file contents.
Throws: AS400SecurityException
If a security or authority error occurs.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: InterruptedIOException
If this thread is interrupted.
Throws: ExtendedIOException
If an error occurs while communicating with the AS/400.
Throws: ServerStartupException
If the AS/400 server cannot be started.
Throws: UnknownHostException
If the AS/400 system cannot be located.
 o IFSTextFileOutputStream
 public IFSTextFileOutputStream(AS400 system,
                                IFSJavaFile file,
                                int shareOption,
                                boolean append,
                                int ccsid) throws AS400SecurityException, IOException
Constructs an IFSTextFileOutputStream object. It creates a file output stream to write to the text file specified by file using the CCSID specified by ccsid.

Parameters:
system - The AS400 that contains the file.
file - The file to be opened for writing.
shareOption - Indicates how other user's can access the file.
  • SHARE_ALL Share access with readers and writers
  • SHARE_NONE Share access with none
  • SHARE_READERS Share access with readers
  • SHARE_WRITERS Share access with writers
append - Controls the behavior when the file exists. If true output is appended to the file; otherwise the output replaces the file contents.
ccsid - The CCSID of the data being written to the file.
Throws: AS400SecurityException
If a security or authority error occurs.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: InterruptedIOException
If this thread is interrupted.
Throws: ExtendedIOException
If an error occurs while communicating with the AS/400.
Throws: ServerStartupException
If the AS/400 server cannot be started.
Throws: UnknownHostException
If the AS/400 system cannot be located.
 o IFSTextFileOutputStream
 public IFSTextFileOutputStream(IFSFileDescriptor fd)
Constructs an IFSTextFileOutputStream object. It creates a file output stream to write to file descriptor fd.

Parameters:
fd - The file descriptor to be opened for writing.

Methods

 o close
 public void close() throws IOException
Closes this text file output stream and releases any system resources associated with the stream.

Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: ExtendedIOException
If an error occurs while communicating with the AS/400.
Throws: InterruptedIOException
If this thread is interrupted.
Overrides:
close in class IFSFileOutputStream
 o finalize
 protected void finalize() throws IOException
Ensures that the text file output stream is closed when there are no more references to it.

Throws: IOException
If an error occurs while communicating with the AS/400.
Overrides:
finalize in class IFSFileOutputStream
 o flush
 public void flush() throws IOException
Forces any buffered output bytes to be written.

Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: InterruptedIOException
If this thread is interrupted.
Throws: ExtendedIOException
If an error occurs while communicating with the AS/400.
Throws: ServerStartupException
If the AS/400 server cannot be started.
Throws: UnknownHostException
If the AS/400 system cannot be located.
Overrides:
flush in class IFSFileOutputStream
 o getCCSID
 public int getCCSID()
Returns the CCSID.

Returns:
The CCSID.
 o setCCSID
 public void setCCSID(int ccsid) throws PropertyVetoException
Sets the CCSID for the data written to the file.

Parameters:
ccsid - The target CCSID.
Throws: PropertyVetoException
If the change is vetoed.
 o write
 public void write(String data) throws IOException
Writes characters to this text file input stream. The characters that are written to the file are converted to the specified CCSID.

Parameters:
data - The characters to write to the stream.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: ExtendedIOException
If an error occurs while communicating with the AS/400.
Throws: InterruptedIOException
If this thread is interrupted.
Throws: ServerStartupException
If the AS/400 server cannot be started.
Throws: UnknownHostException
If the AS/400 system cannot be located.
Throws: UnsupportedEncodingException
If the specified character encoding is not supported.
See Also:
getCCSID, setCCSID

All Packages  Class Hierarchy  This Package  Previous  Next  Index