< prev index next >
src/java.base/share/classes/java/io/RandomAccessFile.java
Print this page
*** 373,383 ****
* @param b the buffer into which the data is read.
* @param off the start offset of the data.
* @param len the number of bytes to read.
* @exception IOException If an I/O error has occurred.
*/
! private native int readBytes(byte b[], int off, int len) throws IOException;
/**
* Reads up to {@code len} bytes of data from this file into an
* array of bytes. This method blocks until at least one byte of input
* is available.
--- 373,383 ----
* @param b the buffer into which the data is read.
* @param off the start offset of the data.
* @param len the number of bytes to read.
* @exception IOException If an I/O error has occurred.
*/
! private native int readBytes(byte[] b, int off, int len) throws IOException;
/**
* Reads up to {@code len} bytes of data from this file into an
* array of bytes. This method blocks until at least one byte of input
* is available.
*** 400,410 ****
* @exception NullPointerException If {@code b} is {@code null}.
* @exception IndexOutOfBoundsException If {@code off} is negative,
* {@code len} is negative, or {@code len} is greater than
* {@code b.length - off}
*/
! public int read(byte b[], int off, int len) throws IOException {
return readBytes(b, off, len);
}
/**
* Reads up to {@code b.length} bytes of data from this file
--- 400,410 ----
* @exception NullPointerException If {@code b} is {@code null}.
* @exception IndexOutOfBoundsException If {@code off} is negative,
* {@code len} is negative, or {@code len} is greater than
* {@code b.length - off}
*/
! public int read(byte[] b, int off, int len) throws IOException {
return readBytes(b, off, len);
}
/**
* Reads up to {@code b.length} bytes of data from this file
*** 423,433 ****
* @exception IOException If the first byte cannot be read for any reason
* other than end of file, or if the random access file has been closed, or if
* some other I/O error occurs.
* @exception NullPointerException If {@code b} is {@code null}.
*/
! public int read(byte b[]) throws IOException {
return readBytes(b, 0, b.length);
}
/**
* Reads {@code b.length} bytes from this file into the byte
--- 423,433 ----
* @exception IOException If the first byte cannot be read for any reason
* other than end of file, or if the random access file has been closed, or if
* some other I/O error occurs.
* @exception NullPointerException If {@code b} is {@code null}.
*/
! public int read(byte[] b) throws IOException {
return readBytes(b, 0, b.length);
}
/**
* Reads {@code b.length} bytes from this file into the byte
*** 440,450 ****
* @throws NullPointerException if {@code b} is {@code null}.
* @throws EOFException if this file reaches the end before reading
* all the bytes.
* @throws IOException if an I/O error occurs.
*/
! public final void readFully(byte b[]) throws IOException {
readFully(b, 0, b.length);
}
/**
* Reads exactly {@code len} bytes from this file into the byte
--- 440,450 ----
* @throws NullPointerException if {@code b} is {@code null}.
* @throws EOFException if this file reaches the end before reading
* all the bytes.
* @throws IOException if an I/O error occurs.
*/
! public final void readFully(byte[] b) throws IOException {
readFully(b, 0, b.length);
}
/**
* Reads exactly {@code len} bytes from this file into the byte
*** 462,472 ****
* {@code b.length - off}.
* @throws EOFException if this file reaches the end before reading
* all the bytes.
* @throws IOException if an I/O error occurs.
*/
! public final void readFully(byte b[], int off, int len) throws IOException {
int n = 0;
do {
int count = this.read(b, off + n, len - n);
if (count < 0)
throw new EOFException();
--- 462,472 ----
* {@code b.length - off}.
* @throws EOFException if this file reaches the end before reading
* all the bytes.
* @throws IOException if an I/O error occurs.
*/
! public final void readFully(byte[] b, int off, int len) throws IOException {
int n = 0;
do {
int count = this.read(b, off + n, len - n);
if (count < 0)
throw new EOFException();
*** 531,550 ****
* @param off the start offset in the data
* @param len the number of bytes that are written
* @exception IOException If an I/O error has occurred.
*/
! private native void writeBytes(byte b[], int off, int len) throws IOException;
/**
* Writes {@code b.length} bytes from the specified byte array
* to this file, starting at the current file pointer.
*
* @param b the data.
* @exception IOException if an I/O error occurs.
*/
! public void write(byte b[]) throws IOException {
writeBytes(b, 0, b.length);
}
/**
* Writes {@code len} bytes from the specified byte array
--- 531,550 ----
* @param off the start offset in the data
* @param len the number of bytes that are written
* @exception IOException If an I/O error has occurred.
*/
! private native void writeBytes(byte[] b, int off, int len) throws IOException;
/**
* Writes {@code b.length} bytes from the specified byte array
* to this file, starting at the current file pointer.
*
* @param b the data.
* @exception IOException if an I/O error occurs.
*/
! public void write(byte[] b) throws IOException {
writeBytes(b, 0, b.length);
}
/**
* Writes {@code len} bytes from the specified byte array
*** 553,563 ****
* @param b the data.
* @param off the start offset in the data.
* @param len the number of bytes to write.
* @exception IOException if an I/O error occurs.
*/
! public void write(byte b[], int off, int len) throws IOException {
writeBytes(b, off, len);
}
// 'Random access' stuff
--- 553,563 ----
* @param b the data.
* @param off the start offset in the data.
* @param len the number of bytes to write.
* @exception IOException if an I/O error occurs.
*/
! public void write(byte[] b, int off, int len) throws IOException {
writeBytes(b, off, len);
}
// 'Random access' stuff
< prev index next >