All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.as400.access.IFSRandomAccessFile

java.lang.Object
   |
   +----com.ibm.as400.access.IFSRandomAccessFile

public class IFSRandomAccessFile
extends Object
implements DataInput, DataOutput, Serializable
The IFSRandomAccessFile class supports read and write access to integrated file system objects. The position at which the next access occurs can be modified. This class offers methods that allow specified mode access of read-only, write-only, or read-write.
IFSRandomAccessFile objects are capable of generating file events that call the following FileListener methods: fileClosed, fileModified, and fileOpened.
The following example illustrates the use of IFSRandomAccessFile:
// Work with /Dir/File on the system eniac.
AS400 as400 = new AS400("eniac");
IFSRandomAccessFile file = new IFSRandomAccessFile(as400, "/Dir/File");
// Determine the file length. long length = file.length();
// Lock the first 11 bytes. IFSKey key = file.lock(0, 11);
// Write a string to the file. file.writeChars("Hello world");
// Read the string we just wrote. file.seek(0); String s = file.readLine();
// Close the file. file.close();

See Also:
FileEvent, addFileListener, removeFileListener

Variable Index

 o FAIL_OR_CREATE
File existence option that indicates that the request is either to fail if the file exists or is to create the file if it does not exist.
 o OPEN_OR_CREATE
File existence option that indicates that the file is either to be opened if it exists or is to be created if it does not exist.
 o OPEN_OR_FAIL
File existence option that indicates that the file is either to be opened if it exists or that the request is to fail if the file does not exist.
 o REPLACE_OR_CREATE
File existence option that indicates that the file is either to be replaced if it exists or is to be created if it does not exist.
 o REPLACE_OR_FAIL
File existence option that indicates that the file is either to be replaced if it exists or that the request is to fail if the file does not exist.
 o SHARE_ALL
Share option that allows read and write access by other users.
 o SHARE_NONE
Share option that does not allow read or write access by other users.
 o SHARE_READERS
Share option that allows only read access by other users.
 o SHARE_WRITERS
Share option that allows only write access by other users.

Constructor Index

 o IFSRandomAccessFile()
Constructs an IFSRandomAccessFile object.
 o IFSRandomAccessFile(AS400, IFSFile, String, int, int)
Constructs an IFSRandomAccessFile object.
 o IFSRandomAccessFile(AS400, String, String)
Constructs an IFSRandomAccessFile object.
 o IFSRandomAccessFile(AS400, String, String, int, int)
Constructs an IFSRandomAccessFile object.

Method Index

 o addFileListener(FileListener)
Adds a file listener to receive file events from this IFSRandomAccessFile.
 o addPropertyChangeListener(PropertyChangeListener)
Adds a property change listener.
 o addVetoableChangeListener(VetoableChangeListener)
Adds a vetoable change listener.
 o close()
Closes this random access file stream and releases any system resources associated with the stream.
 o finalize()
Ensures that the stream is closed when there are no more references to it.
 o flush()
Forces any buffered output bytes to be written.
 o getExistenceOption()
Returns the existence option for this object.
 o getFD()
Returns a file descriptor associated with this stream.
 o getFilePointer()
Returns the current offset in this file.
 o getPath()
Returns the integrated file system path name of the object represented by this IFSRandomAccessFile.
 o getShareOption()
Returns the share option for this object.
 o getSystem()
Returns the AS400 system object for this stream.
 o length()
Returns the file length.
 o lock(int, int)
Places a lock on the file at the specified bytes.
 o read()
Reads the next byte of data from this file.
 o read(byte[])
Reads up to data.length bytes of data from this input stream into data.
 o read(byte[], int, int)
Reads up to length bytes of data from this input stream into data, starting at the array offset dataOffset.
 o readBoolean()
Reads a boolean from this file.
 o readByte()
Reads a signed 8-bit value from this file.
 o readChar()
Reads a Unicode character from this file.
 o readDouble()
Reads a double from this file.
 o readFloat()
Reads a float from this file.
 o readFully(byte[])
Reads data.length bytes from this file into the byte array.
 o readFully(byte[], int, int)
Reads exactly length bytes from this file into the byte array.
 o readInt()
Reads a signed 32-bit integer from this file.
 o readLine()
Reads the next line of text from this file.
 o readLong()
Reads a signed 64-bit integer from this file.
 o readShort()
Reads a signed 16-bit integer from this file.
 o readUnsignedByte()
Reads an unsigned 8-bit number from this file.
 o readUnsignedShort()
Reads an unsigned 16-bit number from this file.
 o readUTF()
Reads in a string from this file.
 o removeFileListener(FileListener)
Removes a file listener so that it no longer receives file events from this IFSRandomAccessFile.
 o removePropertyChangeListener(PropertyChangeListener)
Removes a property change listener.
 o removeVetoableChangeListener(VetoableChangeListener)
Removes a vetoable change listener.
 o seek(long)
Sets the offset, from the beginning of this file, at which the next read or write occurs.
 o setExistenceOption(int)
Sets the existence option.
 o setMode(String)
Sets the access mode.
 o setPath(String)
Sets the file path.
 o setShareOption(int)
Sets the share option.
 o setSystem(AS400)
Sets the system.
 o skipBytes(int)
Skips over the next bytesToSkip bytes in the stream.
 o unlock(IFSKey)
Undoes a lock on this file.
 o write(byte[])
Writes data.length bytes of data from the byte array data to this file output stream.
 o write(byte[], int, int)
Writes length bytes from the byte array data, starting at dataOffset, to this file.
 o write(int)
Writes the specified byte to this file.
 o writeBoolean(boolean)
Writes a boolean to the file as a one-byte value.
 o writeByte(int)
Writes a byte to the file as a one-byte value.
 o writeBytes(String)
Writes out the string to the file as a sequence of bytes.
 o writeChar(int)
Writes a char to the file as a two-byte value, high byte first.
 o writeChars(String)
Writes a string to the file as a sequence of characters.
 o writeDouble(double)
Converts the double argument to a long using the doubleToLongBits method in class Double, and then writes that long value to the file as an eight-byte quantity, high-byte first.
 o writeFloat(float)
Converts the float argument to an int using the floatToIntBits method in class Float, and then writes that int value to the file as a four-byte quantity, high-byte first.
 o writeInt(int)
Writes an int to the file as four bytes, high-byte first.
 o writeLong(long)
Writes a long to the file as eight bytes, high-byte first.
 o writeShort(int)
Writes a short to the file as two bytes, high-byte first.
 o writeUTF(String)
Writes out a string to the file using UTF-8 encoding in a machine-independent manner.
First, two bytes are written to the file as if by the writeShort method giving the number of bytes to follow.

Variables

 o SHARE_ALL
 public static final int SHARE_ALL
Share option that allows read and write access by other users.

 o SHARE_NONE
 public static final int SHARE_NONE
Share option that does not allow read or write access by other users.

 o SHARE_READERS
 public static final int SHARE_READERS
Share option that allows only read access by other users.

 o SHARE_WRITERS
 public static final int SHARE_WRITERS
Share option that allows only write access by other users.

 o FAIL_OR_CREATE
 public static final int FAIL_OR_CREATE
File existence option that indicates that the request is either to fail if the file exists or is to create the file if it does not exist.

 o OPEN_OR_CREATE
 public static final int OPEN_OR_CREATE
File existence option that indicates that the file is either to be opened if it exists or is to be created if it does not exist.

 o OPEN_OR_FAIL
 public static final int OPEN_OR_FAIL
File existence option that indicates that the file is either to be opened if it exists or that the request is to fail if the file does not exist.

 o REPLACE_OR_CREATE
 public static final int REPLACE_OR_CREATE
File existence option that indicates that the file is either to be replaced if it exists or is to be created if it does not exist.

 o REPLACE_OR_FAIL
 public static final int REPLACE_OR_FAIL
File existence option that indicates that the file is either to be replaced if it exists or that the request is to fail if the file does not exist.

Constructors

 o IFSRandomAccessFile
 public IFSRandomAccessFile()
Constructs an IFSRandomAccessFile object. It is a default random access file. Other readers and writers are allowed to access the file.

 o IFSRandomAccessFile
 public IFSRandomAccessFile(AS400 system,
                            String name,
                            String mode) throws AS400SecurityException, IOException
Constructs an IFSRandomAccessFile object. It uses the specified system name, file name, and mode. If the mode is r, the file is opened if it exists; otherwise, an IOException is thrown. If the mode is rw or w, the file is opened if it exists; otherwise, the file is created. Other readers and writers are allowed to access the file.

Parameters:
system - The AS400 that contains the file.
name - The file name.
mode - The access mode
  • "r" read only
  • "w" write only
  • "rw" read/write
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 IFSRandomAccessFile
 public IFSRandomAccessFile(AS400 system,
                            String name,
                            String mode,
                            int shareOption,
                            int existenceOption) throws AS400SecurityException, IOException
Constructs an IFSRandomAccessFile object. It uses the specified system name, file name, mode, share option, and existence option.

Parameters:
system - The AS400 that contains the file.
name - The file name.
mode - The acess mode
  • "r" read only
  • "w" write only
  • "rw" read/write
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
existenceOption - Indicates if the file should be created, opened or if the request should fail based on the existence of the file.
  • FAIL_OR_CREATE Fail if exists; create if not
  • OPEN_OR_CREATE Open if exists; create if not
  • OPEN_OR_FAIL Open if exists; fail if not
  • REPLACE_OR_CREATE Replace if exists; create if not
  • REPLACE_OR_FAIL Replace if exists; fail if not
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 IFSRandomAccessFile
 public IFSRandomAccessFile(AS400 system,
                            IFSFile file,
                            String mode,
                            int shareOption,
                            int existenceOption) throws AS400SecurityException, IOException
Constructs an IFSRandomAccessFile object. It uses the specified system name, file name, mode, share option, and existence option.

Parameters:
system - The AS400 that contains the file.
file - The file to access.
mode - The access mode
  • "r" read only
  • "w" write only
  • "rw" read/write
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
existenceOption - Indicates if the file should be created, opened or if the request should fail based on the existence of the file.
  • FAIL_OR_CREATE Fail if exists; create if not
  • OPEN_OR_CREATE Open if exists; create if not
  • OPEN_OR_FAIL Open if exists; fail if not
  • REPLACE_OR_CREATE Replace if exists; create if not
  • REPLACE_OR_FAIL Replace if exists; fail if not
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.

Methods

 o addFileListener
 public synchronized void addFileListener(FileListener listener)
Adds a file listener to receive file events from this IFSRandomAccessFile.

Parameters:
listener - The file listener.
 o addPropertyChangeListener
 public synchronized void addPropertyChangeListener(PropertyChangeListener listener)
Adds a property change listener.

Parameters:
listener - The property change listener to add.
 o addVetoableChangeListener
 public synchronized void addVetoableChangeListener(VetoableChangeListener listener)
Adds a vetoable change listener.

Parameters:
listener - The vetoable change listener to add.
 o close
 public void close() throws IOException
Closes this random access file stream and releases any system resources associated with the stream.

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.
 o finalize
 protected void finalize() throws IOException
Ensures that the 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 Object
 o flush
 public void flush() throws IOException
Forces any buffered output bytes to be written.

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.
 o getExistenceOption
 public int getExistenceOption()
Returns the existence option for this object.

Returns:
The existence option.
 o getFD
 public final IFSFileDescriptor getFD() throws IOException
Returns a file descriptor associated with this stream.

Returns:
The file descriptor associated whith this stream
Throws: ExtendedIOException
If an error occurs while communicating with the AS/400.
 o getFilePointer
 public long getFilePointer() throws IOException
Returns the current offset in this file.

Returns:
The offset from the beginning of the file, in bytes, at which the next read or write occurs.
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.
 o getPath
 public String getPath()
Returns the integrated file system path name of the object represented by this IFSRandomAccessFile.

Returns:
The absolute path name of the object.
 o getShareOption
 public int getShareOption()
Returns the share option for this object.

Returns:
The share option.
 o getSystem
 public AS400 getSystem()
Returns the AS400 system object for this stream.

Returns:
The AS400 system object.
 o length
 public long length() throws IOException
Returns the file length.

Returns:
The file length, in bytes.
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.
 o lock
 public IFSKey lock(int offset,
                    int length) throws IOException
Places a lock on the file at the specified bytes.

Parameters:
offset - The first byte of the file to lock (zero is the first byte).
length - The number of bytes to lock.
Returns:
A key for undoing this lock.
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.
See Also:
IFSKey, unlock
 o read
 public int read() throws IOException
Reads the next byte of data from this file.

Returns:
The next byte of data, or -1 if the end of file is reached.
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.
 o read
 public int read(byte data[]) throws IOException
Reads up to data.length bytes of data from this input stream into data.

Parameters:
data - The buffer into which data is read.
Returns:
The total number of bytes read into the buffer, or -1 if there is no more data because the end of file has been reached.
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.
 o read
 public int read(byte data[],
                 int dataOffset,
                 int length) throws IOException
Reads up to length bytes of data from this input stream into data, starting at the array offset dataOffset.

Parameters:
data - The buffer into which the data is read.
offset - The start offset of the data in the buffer.
length - The maximum number of bytes to read.
Returns:
The total number of bytes read into the buffer, or -1 if there is no more data because the end of file has been reached.
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.
 o readBoolean
 public final boolean readBoolean() throws IOException
Reads a boolean from this file. This method reads a single byte from the file. A value of 0 represents false. Any other value represents true.

Returns:
The boolean value read.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: EOFException
If the end of file has been reached.
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.
 o readByte
 public final byte readByte() throws IOException
Reads a signed 8-bit value from this file. This method reads a single byte from the file.

Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: EOFException
If the end of file has been reached.
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.
 o readChar
 public final char readChar() throws IOException
Reads a Unicode character from this file. Two bytes are read from the file.

Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: EOFException
If the end of file has been reached.
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.
 o readDouble
 public final double readDouble() throws IOException
Reads a double from this file. This method reads a long value as if by the readLong method and then converts that long to a double using the longBitsToDouble method in class Double.

Returns:
The next eight bytes of this file, interpreted as a double.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: EOFException
If the end of file has been reached.
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.
 o readFloat
 public final float readFloat() throws IOException
Reads a float from this file. This method reads an int value as if by the readInt method and then converts that int to a float using the intBitsToFloat method in class Float.

Returns:
The next four bytes of this file, interpreted as a float.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: EOFException
If the end of file has been reached.
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.
 o readFully
 public final void readFully(byte data[]) throws IOException
Reads data.length bytes from this file into the byte array. This method reads repeatedly from the file until all the bytes are read or an exception is thrown.

Parameters:
data - The buffer into which data is read.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: EOFException
If the end of file has been reached.
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.
 o readFully
 public final void readFully(byte data[],
                             int dataOffset,
                             int length) throws IOException
Reads exactly length bytes from this file into the byte array. This method reads repeatedly from the file until all the bytes are read or an exception is thrown.

Parameters:
data - The buffer into which data is read.
dataOffset - The start offset in the data buffer.
length - The number of bytes to read.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: EOFException
If the end of file has been reached.
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.
 o readInt
 public final int readInt() throws IOException
Reads a signed 32-bit integer from this file.

Returns:
The next four bytes of this file, interpreted as an integer.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: EOFException
If the end of file has been reached.
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.
 o readLine
 public final synchronized String readLine() throws IOException
Reads the next line of text from this file. This method successively reads bytes from the file until it reaches the end of a line of text. A line of text is terminated by a carriage return character (\r), a newline character (\n), a carriage return character immediately followed by a newline character, or the end of the input stream. The line-terminating characters, if any, are included as part of the string returned.

Returns:
The next line of text from this file.
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.
 o readLong
 public final long readLong() throws IOException
Reads a signed 64-bit integer from this file.

Returns:
The next eight bytes of the file, interpreted as a long.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: EOFException
If the end of file has been reached.
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.
 o readShort
 public final short readShort() throws IOException
Reads a signed 16-bit integer from this file.

Returns:
The next two bytes of this file, interpreted as a short.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: EOFException
If the end of file has been reached.
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.
 o readUnsignedByte
 public final int readUnsignedByte() throws IOException
Reads an unsigned 8-bit number from this file. This method reads a byte from this file and returns that byte.

Returns:
The next byte of this file, interpreted as an unsigned 8-bit number.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: EOFException
If the end of file has been reached.
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.
 o readUnsignedShort
 public final int readUnsignedShort() throws IOException
Reads an unsigned 16-bit number from this file.

Returns:
The next two bytes of this file, interpreted as an unsigned 16-bit number.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: EOFException
If the end of file has been reached.
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.
 o readUTF
 public final String readUTF() throws IOException
Reads in a string from this file. The string has been encoded using a modified UTF-8 format.
The first two bytes are read as if by readUnsignedShort. This values gives the number of following bytes that are in the encoded string (note, not the length of the resulting string). The following bytes are then interpreted as bytes encoding characters in the UTF-8 format and are converted into characters.

Returns:
A Unicode string.
Throws: ConnectionDroppedException
If the connection is dropped unexpectedly.
Throws: EOFException
If the end of file has been reached.
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: UTFDataFormatException
If the bytes do not represent a valid UTF-8 encoding of a Unicode string.
 o removeFileListener
 public synchronized void removeFileListener(FileListener listener)
Removes a file listener so that it no longer receives file events from this IFSRandomAccessFile.

Parameters:
listener - The file listener.
 o removePropertyChangeListener
 public synchronized void removePropertyChangeListener(PropertyChangeListener listener)
Removes a property change listener.

Parameters:
listener - The property change listener to remove.
 o removeVetoableChangeListener
 public synchronized void removeVetoableChangeListener(VetoableChangeListener listener)
Removes a vetoable change listener.

Parameters:
listener - The vetoable change listener to remove.
 o seek
 public void seek(long position) throws IOException
Sets the offset, from the beginning of this file, at which the next read or write occurs.

Parameters:
position - The absolute position of the file pointer.
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.
 o setExistenceOption
 public void setExistenceOption(int existenceOption) throws PropertyVetoException
Sets the existence option.

Parameters:
existenceOption - Indicates if the file should be created, opened or if the request should fail based on the existence of the file.
  • FAIL_OR_CREATE Fail if exists; create if not
  • OPEN_OR_CREATE Open if exists; create if not
  • OPEN_OR_FAIL Open if exists; fail if not
  • REPLACE_OR_CREATE Replace if exists; create if not
  • REPLACE_OR_FAIL Replace if exists; fail if not
Throws: PropertyVetoException
If the change is vetoed.
 o setMode
 public void setMode(String mode) throws PropertyVetoException
Sets the access mode.

Parameters:
mode - The access mode.
  • "r" read only
  • "w" write only
  • "rw" read/write
.
Throws: PropertyVetoException
If the change is vetoed.
 o setPath
 public void setPath(String path) throws PropertyVetoException
Sets the file path. Sets the integrated file system path name.

Parameters:
path - The absolute integrated file system path name.
Throws: PropertyVetoException
If the change is vetoed.
 o setShareOption
 public void setShareOption(int shareOption) throws PropertyVetoException
Sets the share option.

Parameters:
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: PropertyVetoException
If the change is vetoed.
 o setSystem
 public void setSystem(AS400 system) throws PropertyVetoException
Sets the system.

Parameters:
system - The AS/400 system object.
Throws: PropertyVetoException
If the change is vetoed.
 o skipBytes
 public int skipBytes(int bytesToSkip) throws IOException
Skips over the next bytesToSkip bytes in the stream.

Parameters:
bytesToSkip - The number of bytes to skip.
Returns:
The number of bytes skipped.
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.
 o unlock
 public void unlock(IFSKey key) throws IOException
Undoes a lock on this file.

Parameters:
key - The key for the lock.
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.
See Also:
IFSKey, lock
 o write
 public void write(int b) throws IOException
Writes the specified byte to this file.

Parameters:
b - The byte to write.
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.
 o write
 public void write(byte data[]) throws IOException
Writes data.length bytes of data from the byte array data to this file output stream.

Parameters:
data - The data to write.
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.
 o write
 public void write(byte data[],
                   int dataOffset,
                   int length) throws IOException
Writes length bytes from the byte array data, starting at dataOffset, to this file.

Parameters:
data - The data.
dataOffset - The start offset in the data.
length - The number of bytes to write.
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.
 o writeBoolean
 public final void writeBoolean(boolean value) throws IOException
Writes a boolean to the file as a one-byte value. The value true is written out as the value (byte)1. The value false is written out as the value (byte)0.

Parameters:
value - The value to be written.
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.
 o writeByte
 public final void writeByte(int value) throws IOException
Writes a byte to the file as a one-byte value.

Parameters:
value - The value to be written as a byte.
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.
 o writeBytes
 public final void writeBytes(String s) throws IOException
Writes out the string to the file as a sequence of bytes. Each character in the string is written out, in sequence, by discarding its high eight bits. Because this method discards eight bits of data, it should not be used to write double-byte characters. Use writeChars(String) instead.

Parameters:
s - The bytes to write.
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.
See Also:
writeChars
 o writeChar
 public final void writeChar(int value) throws IOException
Writes a char to the file as a two-byte value, high byte first.

Parameters:
value - A character value to write.
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.
 o writeChars
 public final void writeChars(String s) throws IOException
Writes a string to the file as a sequence of characters. Each character is written to the file as if by the writeChar method.

Parameters:
s - A String to write.
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.
 o writeDouble
 public final void writeDouble(double value) throws IOException
Converts the double argument to a long using the doubleToLongBits method in class Double, and then writes that long value to the file as an eight-byte quantity, high-byte first.

Parameters:
value - The value to write.
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.
 o writeFloat
 public final void writeFloat(float value) throws IOException
Converts the float argument to an int using the floatToIntBits method in class Float, and then writes that int value to the file as a four-byte quantity, high-byte first.

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.
 o writeInt
 public final void writeInt(int value) throws IOException
Writes an int to the file as four bytes, high-byte first.

Parameters:
value - The int to write.
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.
 o writeLong
 public final void writeLong(long value) throws IOException
Writes a long to the file as eight bytes, high-byte first.

Parameters:
value - The value to write.
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.
 o writeShort
 public final void writeShort(int value) throws IOException
Writes a short to the file as two bytes, high-byte first.

Parameters:
value - The value to write.
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.
 o writeUTF
 public final void writeUTF(String s) throws IOException
Writes out a string to the file using UTF-8 encoding in a machine-independent manner.
First, two bytes are written to the file as if by the writeShort method giving the number of bytes to follow. This value is the number of bytes actually written out, not the length of the string. Following the length, each character of the string is output, in sequence, using the UTF-8 encoding for each character.

Parameters:
s - The string to write.
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.

All Packages  Class Hierarchy  This Package  Previous  Next  Index