@Override public int readInt(long pos) throws IOException { try { return guard.getInt(curBuf, (int) pos); } catch (IllegalArgumentException e) { if (pos < 0) { throw new IllegalArgumentException("Seeking to negative position: " + this, e); } else { throw new EOFException("seek past EOF: " + this); } } catch (NullPointerException npe) { throw new AlreadyClosedException("Already closed: " + this); } }
@Override public final int readInt() throws IOException { try { return guard.getInt(curBuf); } catch (BufferUnderflowException e) { return super.readInt(); } catch (NullPointerException npe) { throw new AlreadyClosedException("Already closed: " + this); } }
@Override public int readInt(long pos) throws IOException { final int bi = (int) (pos >> chunkSizePower); try { return guard.getInt(buffers[bi], (int) (pos & chunkSizeMask)); } catch (IndexOutOfBoundsException ioobe) { // either it's a boundary, or read past EOF, fall back: setPos(pos, bi); return readInt(); } catch (NullPointerException npe) { throw new AlreadyClosedException("Already closed: " + this); } }
@Override public int readInt(long pos) throws IOException { try { return guard.getInt(curBuf, (int) pos); } catch (IllegalArgumentException e) { if (pos < 0) { throw new IllegalArgumentException("Seeking to negative position: " + this, e); } else { throw new EOFException("seek past EOF: " + this); } } catch (NullPointerException npe) { throw new AlreadyClosedException("Already closed: " + this); } }
@Override public final int readInt() throws IOException { try { return guard.getInt(curBuf); } catch (BufferUnderflowException e) { return super.readInt(); } catch (NullPointerException npe) { throw new AlreadyClosedException("Already closed: " + this); } }
@Override public int readInt(long pos) throws IOException { final int bi = (int) (pos >> chunkSizePower); try { return guard.getInt(buffers[bi], (int) (pos & chunkSizeMask)); } catch (IndexOutOfBoundsException ioobe) { // either it's a boundary, or read past EOF, fall back: setPos(pos, bi); return readInt(); } catch (NullPointerException npe) { throw new AlreadyClosedException("Already closed: " + this); } }