/** * Read some bytes into the specified array. * * @param bytes The byte array to read into * @return The number of bytes read or <code>-1</code> * if the end of file has been reached and * <code>throwEofException</code> is set to {@code false}. * @throws EOFException if the end of file is reached and * <code>throwEofException</code> is set to {@code true}. * @throws IOException if trying to read past the end of file. */ @Override public int read(final byte[] bytes) throws IOException { return read(bytes, 0, bytes.length); }
/** * Read some bytes into the specified array. * * @param bytes The byte array to read into * @return The number of bytes read or <code>-1</code> * if the end of file has been reached and * <code>throwEofException</code> is set to <code>false</code>. * @throws EOFException if the end of file is reached and * <code>throwEofException</code> is set to <code>true</code>. * @throws IOException if trying to read past the end of file. */ public int read(byte[] bytes) throws IOException { return read(bytes, 0, bytes.length); }
/** * Read some bytes into the specified array. * * @param bytes The byte array to read into * @return The number of bytes read or <code>-1</code> * if the end of file has been reached and * <code>throwEofException</code> is set to <code>false</code>. * @throws EOFException if the end of file is reached and * <code>throwEofException</code> is set to <code>true</code>. * @throws IOException if trying to read past the end of file. */ public int read(byte[] bytes) throws IOException { return read(bytes, 0, bytes.length); }
/** * Read some bytes into the specified array. * * @param bytes The byte array to read into * @return The number of bytes read or <code>-1</code> * if the end of file has been reached and * <code>throwEofException</code> is set to <code>false</code>. * @throws EOFException if the end of file is reached and * <code>throwEofException</code> is set to <code>true</code>. * @throws IOException if trying to read past the end of file. */ public int read(byte[] bytes) throws IOException { return read(bytes, 0, bytes.length); }
/** * Read some bytes into the specified array. * * @param bytes The byte array to read into * @return The number of bytes read or <code>-1</code> * if the end of file has been reached and * <code>throwEofException</code> is set to {@code false}. * @throws EOFException if the end of file is reached and * <code>throwEofException</code> is set to {@code true}. * @throws IOException if trying to read past the end of file. */ @Override public int read(final byte[] bytes) throws IOException { return read(bytes, 0, bytes.length); }
/** * Read some bytes into the specified array. * * @param bytes The byte array to read into * @return The number of bytes read or <code>-1</code> * if the end of file has been reached and * <code>throwEofException</code> is set to <code>false</code>. * @throws EOFException if the end of file is reached and * <code>throwEofException</code> is set to <code>true</code>. * @throws IOException if trying to read past the end of file. */ @Override public int read(byte[] bytes) throws IOException { return read(bytes, 0, bytes.length); }
/** * Read some bytes into the specified array. * * @param bytes The byte array to read into * @return The number of bytes read or <code>-1</code> * if the end of file has been reached and * <code>throwEofException</code> is set to {@code false}. * @throws EOFException if the end of file is reached and * <code>throwEofException</code> is set to {@code true}. * @throws IOException if trying to read past the end of file. */ @Override public int read(byte[] bytes) throws IOException { return read(bytes, 0, bytes.length); }
/** * Read some bytes into the specified array. * * @param bytes The byte array to read into * @return The number of bytes read or <code>-1</code> * if the end of file has been reached and * <code>throwEofException</code> is set to {@code false}. * @throws EOFException if the end of file is reached and * <code>throwEofException</code> is set to {@code true}. * @throws IOException if trying to read past the end of file. */ @Override public int read(final byte[] bytes) throws IOException { return read(bytes, 0, bytes.length); }
@Override public synchronized int read(final byte[] chunk, final Long offset) throws IOException { final RandomAccessFile file = random(); if(offset < file.length()) { file.seek(offset); if(chunk.length + offset > file.length()) { return file.read(chunk, 0, (int) (file.length() - offset)); } else { return file.read(chunk, 0, chunk.length); } } else { final NullInputStream nullStream = new NullInputStream(length); if(nullStream.available() > 0) { nullStream.skip(offset); return nullStream.read(chunk, 0, chunk.length); } else { return IOUtils.EOF; } } }