/** * This method is a shorthand for {@link #readFully(java.io.InputStream, byte[], int, int)}. * * @param in the InputStream to read from * @param b the buffer into which the stream data is copied * @return the same byte array that was passed, returned only for convience * @throws java.io.EOFException if EOF is reached before all bytes have been read * @throws IOException if an I/O error occurs */ public static byte[] readFully(InputStream in, byte b[]) throws EOFException, IOException { return readFully(in, b, 0, b.length); }
/** * Reads <code>b.length</code> bytes from this file into the byte array, starting at the current file pointer. * This method reads repeatedly from the file until the requested number of bytes are read. This method blocks until * the requested number of bytes are read, the end of the stream is detected, or an exception is thrown. * * @param b the buffer into which the data is read. * @throws java.io.EOFException if this file reaches the end before reading all the bytes. * @throws IOException if an I/O error occurs. */ public void readFully(byte b[]) throws IOException { StreamUtils.readFully(this, b, 0, b.length); }
/** * Reads exactly <code>len</code> bytes from this file into the byte array, starting at the current file pointer. * This method reads repeatedly from the file until the requested number of bytes are read. This method blocks until * the requested number of bytes are read, the end of the stream is detected, or an exception is thrown. * * @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. * @throws java.io.EOFException if this file reaches the end before reading all the bytes. * @throws IOException if an I/O error occurs. */ public void readFully(byte b[], int off, int len) throws IOException { StreamUtils.readFully(this, b, off, len); }
StreamUtils.readFully(rais, buffer); len -= buffer.length; extent++;
byte[] skipBuf = BufferPool.getByteArray(SKIP_BYTE_SIZE); // Use a constant buffer size to always reuse the same instance try { StreamUtils.readFully(in, skipBuf, 0, (int)(offset-this.offset)); this.offset = offset;
StreamUtils.readFully(rais, buf, 0, bufLen);