/* @see java.io.DataInput.readShort() */ public short readShort() throws IOException { buffer(position, 2); position += 2; try { return buffer.getShort(); } catch (BufferUnderflowException e) { EOFException eof = new EOFException(EOF_ERROR_MSG); eof.initCause(e); throw eof; } }
/* @see java.io.DataInput.readInt() */ public int readInt() throws IOException { buffer(position, 4); position += 4; try { return buffer.getInt(); } catch (BufferUnderflowException e) { EOFException eof = new EOFException(EOF_ERROR_MSG); eof.initCause(e); throw eof; } }
/* @see java.io.DataInput.readLong() */ public long readLong() throws IOException { buffer(position, 8); position += 8; try { return buffer.getLong(); } catch (BufferUnderflowException e) { EOFException eof = new EOFException(EOF_ERROR_MSG); eof.initCause(e); throw eof; } }
/* @see java.io.DataInput.readByte() */ public byte readByte() throws IOException { buffer(position, 1); position += 1; try { return buffer.get(); } catch (BufferUnderflowException e) { EOFException eof = new EOFException(EOF_ERROR_MSG); eof.initCause(e); throw eof; } }
private void rethrowEofException(IOException ioEx) throws IOException { boolean isEof = false; try { isEof = this.in.available() == 0; } catch (Throwable t) { LOG.trace("Error getting available for error message - ignoring", t); } if (!isEof) throw ioEx; if (LOG.isTraceEnabled()) { LOG.trace("Partial cell read caused by EOF", ioEx); } EOFException eofEx = new EOFException("Partial cell read"); eofEx.initCause(ioEx); throw eofEx; }