@Override public short readShort(long pos) throws IOException { try { return guard.getShort(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 short readShort() throws IOException { try { return guard.getShort(curBuf); } catch (BufferUnderflowException e) { return super.readShort(); } catch (NullPointerException npe) { throw new AlreadyClosedException("Already closed: " + this); } }
@Override public short readShort(long pos) throws IOException { final int bi = (int) (pos >> chunkSizePower); try { return guard.getShort(buffers[bi], (int) (pos & chunkSizeMask)); } catch (IndexOutOfBoundsException ioobe) { // either it's a boundary, or read past EOF, fall back: setPos(pos, bi); return readShort(); } catch (NullPointerException npe) { throw new AlreadyClosedException("Already closed: " + this); } }
@Override public short readShort(long pos) throws IOException { try { return guard.getShort(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 short readShort() throws IOException { try { return guard.getShort(curBuf); } catch (BufferUnderflowException e) { return super.readShort(); } catch (NullPointerException npe) { throw new AlreadyClosedException("Already closed: " + this); } }
@Override public short readShort(long pos) throws IOException { final int bi = (int) (pos >> chunkSizePower); try { return guard.getShort(buffers[bi], (int) (pos & chunkSizeMask)); } catch (IndexOutOfBoundsException ioobe) { // either it's a boundary, or read past EOF, fall back: setPos(pos, bi); return readShort(); } catch (NullPointerException npe) { throw new AlreadyClosedException("Already closed: " + this); } }