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
-
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.
-
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.
-
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.
-
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.
-
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.
-
SHARE_ALL
- Share option that allows read and write access by other users.
-
SHARE_NONE
- Share option that does not allow read or write access by other users.
-
SHARE_READERS
- Share option that allows only read access by other users.
-
SHARE_WRITERS
- Share option that allows only write access by other users.
-
IFSRandomAccessFile()
- Constructs an IFSRandomAccessFile object.
-
IFSRandomAccessFile(AS400, IFSFile, String, int, int)
- Constructs an IFSRandomAccessFile object.
-
IFSRandomAccessFile(AS400, String, String)
- Constructs an IFSRandomAccessFile object.
-
IFSRandomAccessFile(AS400, String, String, int, int)
- Constructs an IFSRandomAccessFile object.
-
addFileListener(FileListener)
- Adds a file listener to receive file events from this IFSRandomAccessFile.
-
addPropertyChangeListener(PropertyChangeListener)
- Adds a property change listener.
-
addVetoableChangeListener(VetoableChangeListener)
- Adds a vetoable change listener.
-
close()
- Closes this random access file stream and releases any system resources
associated with the stream.
-
finalize()
- Ensures that the stream is closed when there are no more references to it.
-
flush()
- Forces any buffered output bytes to be written.
-
getExistenceOption()
- Returns the existence option for this object.
-
getFD()
- Returns a file descriptor associated with this stream.
-
getFilePointer()
- Returns the current offset in this file.
-
getPath()
- Returns the integrated file system path name of the object represented by
this IFSRandomAccessFile.
-
getShareOption()
- Returns the share option for this object.
-
getSystem()
- Returns the AS400 system object for this stream.
-
length()
- Returns the file length.
-
lock(int, int)
- Places a lock on the file at the specified bytes.
-
read()
- Reads the next byte of data from this file.
-
read(byte[])
- Reads up to data.length bytes of data from this input stream into
data.
-
read(byte[], int, int)
- Reads up to length bytes of data from this input stream into
data, starting at the array offset dataOffset.
-
readBoolean()
- Reads a boolean from this file.
-
readByte()
- Reads a signed 8-bit value from this file.
-
readChar()
- Reads a Unicode character from this file.
-
readDouble()
- Reads a double from this file.
-
readFloat()
- Reads a float from this file.
-
readFully(byte[])
- Reads data.length bytes from this file into the byte array.
-
readFully(byte[], int, int)
- Reads exactly length bytes from this file into the byte array.
-
readInt()
- Reads a signed 32-bit integer from this file.
-
readLine()
- Reads the next line of text from this file.
-
readLong()
- Reads a signed 64-bit integer from this file.
-
readShort()
- Reads a signed 16-bit integer from this file.
-
readUnsignedByte()
- Reads an unsigned 8-bit number from this file.
-
readUnsignedShort()
- Reads an unsigned 16-bit number from this file.
-
readUTF()
- Reads in a string from this file.
-
removeFileListener(FileListener)
- Removes a file listener so that it no longer receives file events from
this IFSRandomAccessFile.
-
removePropertyChangeListener(PropertyChangeListener)
- Removes a property change listener.
-
removeVetoableChangeListener(VetoableChangeListener)
- Removes a vetoable change listener.
-
seek(long)
- Sets the offset, from the beginning of this file, at which the next read
or write occurs.
-
setExistenceOption(int)
- Sets the existence option.
-
setMode(String)
- Sets the access mode.
-
setPath(String)
- Sets the file path.
-
setShareOption(int)
- Sets the share option.
-
setSystem(AS400)
- Sets the system.
-
skipBytes(int)
- Skips over the next bytesToSkip bytes in the stream.
-
unlock(IFSKey)
- Undoes a lock on this file.
-
write(byte[])
- Writes data.length bytes of data from the byte array data
to this file output stream.
-
write(byte[], int, int)
- Writes length bytes from the byte array data, starting at dataOffset, to this file.
-
write(int)
- Writes the specified byte to this file.
-
writeBoolean(boolean)
- Writes a boolean to the file as a one-byte value.
-
writeByte(int)
- Writes a byte to the file as a one-byte value.
-
writeBytes(String)
- Writes out the string to the file as a sequence of bytes.
-
writeChar(int)
- Writes a char to the file as a two-byte value, high byte first.
-
writeChars(String)
- Writes a string to the file as a sequence of characters.
-
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.
-
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.
-
writeInt(int)
- Writes an int to the file as four bytes, high-byte first.
-
writeLong(long)
- Writes a long to the file as eight bytes, high-byte first.
-
writeShort(int)
- Writes a short to the file as two bytes, high-byte first.
-
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.
SHARE_ALL
public static final int SHARE_ALL
- Share option that allows read and write access by other users.
SHARE_NONE
public static final int SHARE_NONE
- Share option that does not allow read or write access by other users.
SHARE_READERS
public static final int SHARE_READERS
- Share option that allows only read access by other users.
SHARE_WRITERS
public static final int SHARE_WRITERS
- Share option that allows only write access by other users.
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.
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.
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.
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.
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.
IFSRandomAccessFile
public IFSRandomAccessFile()
- Constructs an IFSRandomAccessFile object. It is a default random access file.
Other readers and writers are allowed to access the file.
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: IOException
- If an error occurs while communicating with the AS/400.
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: IOException
- If an error occurs while communicating with the AS/400.
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: IOException
- If an error occurs while communicating with the AS/400.
addFileListener
public void addFileListener(FileListener listener)
- Adds a file listener to receive file events from this IFSRandomAccessFile.
- Parameters:
- listener - The file listener.
addPropertyChangeListener
public void addPropertyChangeListener(PropertyChangeListener listener)
- Adds a property change listener.
- Parameters:
- listener - The property change listener to add.
addVetoableChangeListener
public void addVetoableChangeListener(VetoableChangeListener listener)
- Adds a vetoable change listener.
- Parameters:
- listener - The vetoable change listener to add.
close
public void close() throws IOException
- Closes this random access file stream and releases any system resources
associated with the stream.
- Throws: IOException
- If an error occurs while communicating with the AS/400.
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
flush
public void flush() throws IOException
- Forces any buffered output bytes to be written.
- Throws: IOException
- If an error occurs while communicating with the AS/400.
getExistenceOption
public int getExistenceOption()
- Returns the existence option for this object.
- Returns:
- The existence option.
getFD
public final IFSFileDescriptor getFD() throws IOException
- Returns a file descriptor associated with this stream.
- Returns:
- The file descriptor associated with this stream
- Throws: IOException
- If an error occurs while communicating with the AS/400.
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: IOException
- If an error occurs while communicating with the AS/400.
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.
getShareOption
public int getShareOption()
- Returns the share option for this object.
- Returns:
- The share option.
getSystem
public AS400 getSystem()
- Returns the AS400 system object for this stream.
- Returns:
- The AS400 system object.
length
public long length() throws IOException
- Returns the file length.
- Returns:
- The file length, in bytes.
- Throws: IOException
- If an error occurs while communicating with the AS/400.
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: IOException
- If an error occurs while communicating with the AS/400.
- See Also:
- IFSKey, unlock
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: IOException
- If an error occurs while communicating with the AS/400.
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: IOException
- If an error occurs while communicating with the AS/400.
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: IOException
- If an error occurs while communicating with the AS/400.
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: IOException
- If an error occurs while communicating with the AS/400.
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: IOException
- If an error occurs while communicating with the AS/400.
readChar
public final char readChar() throws IOException
- Reads a Unicode character from this file. Two bytes are read from the file.
- Throws: IOException
- If an error occurs while communicating with the AS/400.
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: IOException
- If an error occurs while communicating with the AS/400.
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: IOException
- If an error occurs while communicating with the AS/400.
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: IOException
- If an error occurs while communicating with the AS/400.
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: IOException
- If an error occurs while communicating with the AS/400.
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: IOException
- If an error occurs while communicating with the AS/400.
readLine
public final 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: IOException
- If an error occurs while communicating with the AS/400.
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: IOException
- If an error occurs while communicating with the AS/400.
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: IOException
- If an error occurs while communicating with the AS/400.
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: IOException
- If an error occurs while communicating with the AS/400.
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: IOException
- If an error occurs while communicating with the AS/400.
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: IOException
- If an error occurs while communicating with the AS/400.
removeFileListener
public void removeFileListener(FileListener listener)
- Removes a file listener so that it no longer receives file events from
this IFSRandomAccessFile.
- Parameters:
- listener - The file listener.
removePropertyChangeListener
public void removePropertyChangeListener(PropertyChangeListener listener)
- Removes a property change listener.
- Parameters:
- listener - The property change listener to remove.
removeVetoableChangeListener
public void removeVetoableChangeListener(VetoableChangeListener listener)
- Removes a vetoable change listener.
- Parameters:
- listener - The vetoable change listener to remove.
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: IOException
- If an error occurs while communicating with the AS/400.
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.
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.
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.
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.
setSystem
public void setSystem(AS400 system) throws PropertyVetoException
- Sets the system.
The system cannot be changed once a connection is made to the server.
- Parameters:
- system - The AS/400 system object.
- Throws: PropertyVetoException
- If the change is vetoed.
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: IOException
- If an error occurs while communicating with the AS/400.
unlock
public void unlock(IFSKey key) throws IOException
- Undoes a lock on this file.
- Parameters:
- key - The key for the lock.
- Throws: IOException
- If an error occurs while communicating with the AS/400.
- See Also:
- IFSKey, lock
write
public void write(int b) throws IOException
- Writes the specified byte to this file.
- Parameters:
- b - The byte to write.
- Throws: IOException
- If an error occurs while communicating with the AS/400.
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: IOException
- If an error occurs while communicating with the AS/400.
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: IOException
- If an error occurs while communicating with the AS/400.
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: IOException
- If an error occurs while communicating with the AS/400.
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: IOException
- If an error occurs while communicating with the AS/400.
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: IOException
- If an error occurs while communicating with the AS/400.
- See Also:
- writeChars
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: IOException
- If an error occurs while communicating with the AS/400.
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: IOException
- If an error occurs while communicating with the AS/400.
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: IOException
- If an error occurs while communicating with the AS/400.
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: IOException
- If an error occurs while communicating with the AS/400.
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: IOException
- If an error occurs while communicating with the AS/400.
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: IOException
- If an error occurs while communicating with the AS/400.
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: IOException
- If an error occurs while communicating with the AS/400.
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: IOException
- If an error occurs while communicating with the AS/400.
All Packages Class Hierarchy This Package Previous Next Index