public class IFSFileReader
extends java.io.Reader
IFSFileInputStream.
If an InputStream is required, use IFSTextFileInputStream.
The following example illustrates the use of IFSFileReader:
import java.io.BufferedReader;
// Work with /File1 on the system eniac.
AS400 system = new AS400("eniac");
IFSFile file = new IFSFile(system, "/File1");
BufferedReader reader = new BufferedReader(new IFSFileReader(file));
// Read the first line of the file, converting characters.
String line1 = reader.readLine();
// Display the String that was read.
System.out.println(line1);
// Close the reader.
reader.close();
| Modifier and Type | Field and Description | 
|---|---|
| static int | SHARE_ALLShare option that allows read and write access by other users. | 
| static int | SHARE_NONEShare option that does not allow read or write access by other users. | 
| static int | SHARE_READERSShare option that allows only read access by other users. | 
| static int | SHARE_WRITERSShare option that allows only write access by other users. | 
| Constructor and Description | 
|---|
| IFSFileReader(IFSFile file)Constructs an IFSFileReader object. | 
| IFSFileReader(IFSFileDescriptor fd)Constructs an IFSFileReader object. | 
| IFSFileReader(IFSFile file,
             int ccsid)Constructs an IFSFileReader object. | 
| IFSFileReader(IFSFile file,
             int ccsid,
             int shareOption)Constructs an IFSFileReader object. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | close()Closes the stream. | 
| int | getCCSID()Returns the CCSID used by this IFSFileReader. | 
| java.lang.String | getEncoding()Returns the encoding used by this IFSFileReader. | 
| IFSKey | lockBytes(int length)Deprecated. 
 Replaced by  lock(long) | 
| IFSKey | lockBytes(long length)Places a lock on the file at the current position for the specified
   number of bytes. | 
| boolean | markSupported()IFSFileReader does not support the mark() operation. | 
| int | read()Reads a single character. | 
| int | read(char[] cbuf)Reads characters into an array. | 
| int | read(char[] cbuf,
    int off,
    int len)Reads characters into a portion of an array. | 
| boolean | ready()Tells whether this stream is ready to be read. | 
| void | reset()Resets the stream. | 
| long | skip(long charsToSkip)Skip characters. | 
| void | unlockBytes(IFSKey key)Undoes a lock on the file. | 
public static final int SHARE_ALL
public static final int SHARE_NONE
public static final int SHARE_READERS
public static final int SHARE_WRITERS
public IFSFileReader(IFSFile file) throws AS400SecurityException, java.io.IOException
file - The file to be opened for reading.AS400SecurityException - If  a security or authority error occurs.java.io.IOException - If an error occurs while communicating with the system.public IFSFileReader(IFSFile file, int ccsid) throws AS400SecurityException, java.io.IOException
file - The file to be opened for reading.ccsid - The CCSID that the file data is currently in.AS400SecurityException - If  a security or authority error occurs.java.io.IOException - If an error occurs while communicating with the system.public IFSFileReader(IFSFile file, int ccsid, int shareOption) throws AS400SecurityException, java.io.IOException
file - The file to be opened for reading.ccsid - The CCSID that the file data is currently in.shareOption - Indicates how users can access the file. AS400SecurityException - If  a security or authority error occurs.java.io.IOException - If an error occurs while communicating with the system.public IFSFileReader(IFSFileDescriptor fd) throws AS400SecurityException, java.io.IOException
fd - The file descriptor to be opened for reading.AS400SecurityException - If a security or authority error occurs.java.io.IOException - If an error occurs while communicating with the system.public void close()
           throws java.io.IOException
close in interface java.io.Closeableclose in class java.io.Readerjava.io.IOException - If an error occurs while communicating with the system.public int getCCSID()
public java.lang.String getEncoding()
public boolean markSupported()
markSupported in class java.io.Readerpublic int read()
         throws java.io.IOException
read in class java.io.Readerjava.io.IOException - If an error occurs while communicating with the system.public int read(char[] cbuf)
         throws java.io.IOException
read in class java.io.Readercbuf - Destination buffer.java.io.IOException - If an error occurs while communicating with the system.public int read(char[] cbuf,
       int off,
       int len)
         throws java.io.IOException
read in class java.io.Readercbuf - Destination buffer.off - Offset at which to start storing characters.len - Maximum number of characters to read.java.io.IOException - If an error occurs while communicating with the system.public boolean ready()
              throws java.io.IOException
ready in class java.io.Readerjava.io.IOException - If an error occurs while communicating with the system.public void reset()
           throws java.io.IOException
reset in class java.io.Readerjava.io.IOException - If an error occurs while communicating with the system.public long skip(long charsToSkip)
          throws java.io.IOException
skip in class java.io.ReadercharsToSkip - The number of characters to skip.java.io.IOException - If an error occurs while communicating with the system.public IFSKey lockBytes(int length) throws java.io.IOException
lock(long)length - The number of bytes to lock.java.io.IOException - If an error occurs while communicating with the system.unlockBytes(com.ibm.as400.access.IFSKey)public IFSKey lockBytes(long length) throws java.io.IOException
length - The number of bytes to lock.java.io.IOException - If an error occurs while communicating with the system.unlockBytes(com.ibm.as400.access.IFSKey)public void unlockBytes(IFSKey key) throws java.io.IOException
key - The key for the lock.java.io.IOException - If an error occurs while communicating with the system.lockBytes(long)