com.ibm.as400.access
Class IFSTextFileInputStream
java.lang.Object
|
+--java.io.InputStream
|
+--com.ibm.as400.access.IFSFileInputStream
|
+--com.ibm.as400.access.IFSTextFileInputStream
- All Implemented Interfaces:
- java.io.Serializable
- public class IFSTextFileInputStream
- extends IFSFileInputStream
- implements java.io.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
,
IFSFileInputStream.addFileListener(com.ibm.as400.access.FileListener)
,
IFSFileInputStream.removeFileListener(com.ibm.as400.access.FileListener)
, Serialized Form
Method Summary |
java.lang.String |
read(int length)
Reads up to length characters from this text file input stream. |
Methods inherited from class com.ibm.as400.access.IFSFileInputStream |
addFileListener, addPropertyChangeListener, addVetoableChangeListener, available, close, finalize, getFD, getPath, getShareOption, getSystem, lock, open, read, read, read, removeFileListener, removePropertyChangeListener, removeVetoableChangeListener, rewind, setFD, setPath, setShareOption, setSystem, skip, unlock |
Methods inherited from class java.io.InputStream |
mark, markSupported, reset |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
IFSTextFileInputStream
public IFSTextFileInputStream()
- Constructs an IFSTextFileInputStream object.
IFSTextFileInputStream
public IFSTextFileInputStream(AS400 system,
java.lang.String name)
throws AS400SecurityException,
java.io.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.java.io.IOException
- If an error occurs while communicating with the AS/400.
IFSTextFileInputStream
public IFSTextFileInputStream(AS400 system,
java.lang.String name,
int shareOption)
throws AS400SecurityException,
java.io.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.java.io.IOException
- If an error occurs while communicating with the AS/400.
IFSTextFileInputStream
public IFSTextFileInputStream(IFSFile file)
throws AS400SecurityException,
java.io.IOException
- Constructs an IFSTextFileInputStream object.
It creates a file input stream to read from the text file specified by file.
Other readers and writers are allowed to access the file. The file is
opened if it exists; otherwise an exception is thrown.
- Parameters:
file
- The file to be opened for reading.- Throws:
AS400SecurityException
- If a security or authority error occurs.java.io.IOException
- If an error occurs while communicating with the AS/400.
IFSTextFileInputStream
public IFSTextFileInputStream(AS400 system,
IFSFile file,
int shareOption)
throws AS400SecurityException,
java.io.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.java.io.IOException
- If an error occurs while communicating with the AS/400.
IFSTextFileInputStream
public IFSTextFileInputStream(IFSJavaFile file)
throws AS400SecurityException,
java.io.IOException
- Constructs an IFSTextFileInputStream object.
It creates a file input stream to read from the text file specified by file.
Other readers and writers are allowed to access the file. The file is
opened if it exists; otherwise an exception is thrown.
- Parameters:
file
- The file to be opened for reading.- Throws:
AS400SecurityException
- If a security or authority error occurs.java.io.IOException
- If an error occurs while communicating with the AS/400.
IFSTextFileInputStream
public IFSTextFileInputStream(AS400 system,
IFSJavaFile file,
int shareOption)
throws AS400SecurityException,
java.io.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.java.io.IOException
- If an error occurs while communicating with the AS/400.
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.
read
public java.lang.String read(int length)
throws java.io.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:
java.io.IOException
- If an error occurs while communicating with the AS/400.