All Packages Class Hierarchy This Package Previous Next Index
Class com.ibm.as400.access.IFSTextFileInputStream
java.lang.Object
|
+----java.io.InputStream
|
+----com.ibm.as400.access.IFSFileInputStream
|
+----com.ibm.as400.access.IFSTextFileInputStream
- public class IFSTextFileInputStream
- extends IFSFileInputStream
- implements Serializable
The IFSTextFileInputStream class represents an integrated file system
input stream for character data.
IFSTextFileInputStream objects are
capable of generating file events which call the following FileListener
methods: fileClosed and fileOpened.
The following example illustrates the use of IFSTextFileInputStream:
// Work with /File on the system eniac.
AS400 as400 = new AS400("eniac");
IFSTextFileInputStream file = new IFSTextFileInputStream(as400, "/File");
// Read the first four characters of the file.
String s = file.read(4);
// Display the characters read.
System.out.println(s);
// Close the file.
file.close();
- See Also:
- FileEvent, addFileListener, removeFileListener
-
IFSTextFileInputStream()
- Constructs an IFSTextFileInputStream object.
-
IFSTextFileInputStream(AS400, IFSFile, int)
- Constructs an IFSTextFileInputStream object.
-
IFSTextFileInputStream(AS400, String)
- Constructs an IFSTextFileInputStream object.
-
IFSTextFileInputStream(AS400, String, int)
- Constructs an IFSTextFileInputStream object.
-
IFSTextFileInputStream(IFSFileDescriptor)
- Constructs an IFSTextFileInputStream object.
-
finalize()
- Ensures that the text file input stream is closed when there are no more
references to it.
-
read(int)
- Reads up to length characters from this text file input stream.
IFSTextFileInputStream
public IFSTextFileInputStream()
- Constructs an IFSTextFileInputStream object.
IFSTextFileInputStream
public IFSTextFileInputStream(AS400 system,
String name) throws AS400SecurityException, IOException
- Constructs an IFSTextFileInputStream object.
It creates a file input stream to read from the text file name.
Other readers and writers are allowed to access the file. The file is
opened if it exists; otherwise an exception is thrown.
- Parameters:
- system - The AS400 that contains the file.
- name - The integrated file system name.
- Throws: AS400SecurityException
- If a security or authority error occurs.
- Throws: ConnectionDroppedException
- If the connection is dropped unexpectedly.
- Throws: ExtendedIOException
- If an error occurs while communicating with the AS/400.
- Throws: FileNotFoundException
- If the file does not exist.
- 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.
IFSTextFileInputStream
public IFSTextFileInputStream(AS400 system,
String name,
int shareOption) throws AS400SecurityException, IOException
- Constructs an IFSTextFileInputStream object.
It creates a file input stream to read from the text file name.
- Parameters:
- system - The AS400 that contains the file.
- name - The integrated file system name.
- shareOption - Indicates how users 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
- Throws: AS400SecurityException
- If a security or authority error occurs.
- Throws: ConnectionDroppedException
- If the connection is dropped unexpectedly.
- Throws: ExtendedIOException
- If an error occurs while communicating with the AS/400.
- Throws: FileNotFoundException
- If the file does not exist.
- 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.
IFSTextFileInputStream
public IFSTextFileInputStream(AS400 system,
IFSFile file,
int shareOption) throws AS400SecurityException, IOException
- Constructs an IFSTextFileInputStream object.
It creates a file input stream to read from the text file specified by file.
- Parameters:
- system - The AS400 that contains the file.
- file - The file to be opened for reading.
- shareOption - Indicates how users 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
- Throws: AS400SecurityException
- If a security or authority error occurs.
- Throws: ConnectionDroppedException
- If the connection is dropped unexpectedly.
- Throws: ExtendedIOException
- If an error occurs while communicating with the AS/400.
- Throws: FileNotFoundException
- If the file does not exist.
- 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.
IFSTextFileInputStream
public IFSTextFileInputStream(IFSFileDescriptor fd)
- Constructs an IFSTextFileInputStream object.
It creates a text file input stream to read from file descriptor fd.
- Parameters:
- fd - The file descriptor to be opened for reading.
finalize
protected void finalize() throws IOException
- Ensures that the text file input 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 IFSFileInputStream
read
public String read(int length) throws IOException
- Reads up to length characters from this text file input stream.
The file contents are converted from the file data CCSID to Unicode if
the encoding is supported.
- Parameters:
- length - The number of characters to read from the stream.
- Returns:
- The characters read from the stream. If the end of file has been
reached an empty String is returned.
- 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 file's character encoding is not supported.
All Packages Class Hierarchy This Package Previous Next Index