/** {@inheritDoc} */ public boolean readBoolean() throws IOException { final int limit = this.limit; if (limit == -1) { throw eofOnRead(); } int position; final byte[] buffer = this.buffer; if ((position = this.position++) == limit) { this.position = 1; if ((this.limit = byteInput.read(buffer)) == -1) { throw eofOnRead(); } return buffer[0] != 0; } this.position = position + 1; return buffer[position] != 0; }
/** {@inheritDoc} */ public byte readByte() throws IOException { final int limit; if ((limit = this.limit) == -1) { throw eofOnRead(); } int position; final byte[] buffer = this.buffer; if ((position = this.position++) == limit) { this.position = 1; if ((this.limit = byteInput.read(buffer)) == -1) { throw eofOnRead(); } return buffer[0]; } this.position = position + 1; return buffer[position]; }
/** * Read an unsigned byte directly. * * @return the unsigned byte * @throws IOException if an error occurs */ protected int readUnsignedByteDirect() throws IOException { final int limit; if ((limit = this.limit) == -1) { throw eofOnRead(); } int position; final byte[] buffer = this.buffer; if ((position = this.position++) == limit) { this.position = 1; if ((this.limit = byteInput.read(buffer)) == -1) { throw eofOnRead(); } return buffer[0] & 0xff; } return buffer[position] & 0xff; }
/** {@inheritDoc} */ public void readFully(final byte[] b, int off, int len) throws IOException { if (limit == -1) { throw eofOnRead(); } final int position = this.position; int remaining = limit - position; if (len > remaining) { if (remaining > 0) { System.arraycopy(buffer, position, b, off, remaining); limit = this.position = 0; off += remaining; len -= remaining; } final ByteInput byteInput = this.byteInput; do { remaining = byteInput.read(b, off, len); if (remaining == -1) { throw eofOnRead(); } off += remaining; len -= remaining; } while (len != 0); } else try { System.arraycopy(buffer, position, b, off, len); this.position = position + len; } catch (NullPointerException e) { throw eofOnRead(); } }
/** {@inheritDoc} */ public byte readByte() throws IOException { final int limit; if ((limit = this.limit) == -1) { throw eofOnRead(); } int position; final byte[] buffer = this.buffer; if ((position = this.position++) == limit) { this.position = 1; if ((this.limit = byteInput.read(buffer)) == -1) { throw eofOnRead(); } return buffer[0]; } this.position = position + 1; return buffer[position]; }
/** {@inheritDoc} */ public boolean readBoolean() throws IOException { final int limit = this.limit; if (limit == -1) { throw eofOnRead(); } int position; final byte[] buffer = this.buffer; if ((position = this.position++) == limit) { this.position = 1; if ((this.limit = byteInput.read(buffer)) == -1) { throw eofOnRead(); } return buffer[0] != 0; } this.position = position + 1; return buffer[position] != 0; }
/** {@inheritDoc} */ public boolean readBoolean() throws IOException { final int limit = this.limit; if (limit == -1) { throw eofOnRead(); } int position; final byte[] buffer = this.buffer; if ((position = this.position++) == limit) { this.position = 1; if ((this.limit = byteInput.read(buffer)) == -1) { throw eofOnRead(); } return buffer[0] != 0; } this.position = position + 1; return buffer[position] != 0; }
/** {@inheritDoc} */ public byte readByte() throws IOException { final int limit; if ((limit = this.limit) == -1) { throw eofOnRead(); } int position; final byte[] buffer = this.buffer; if ((position = this.position++) == limit) { this.position = 1; if ((this.limit = byteInput.read(buffer)) == -1) { throw eofOnRead(); } return buffer[0]; } this.position = position + 1; return buffer[position]; }
/** {@inheritDoc} */ public byte readByte() throws IOException { final int limit; if ((limit = this.limit) == -1) { throw eofOnRead(); } int position; final byte[] buffer = this.buffer; if ((position = this.position++) == limit) { this.position = 1; if ((this.limit = byteInput.read(buffer)) == -1) { throw eofOnRead(); } return buffer[0]; } this.position = position + 1; return buffer[position]; }
/** {@inheritDoc} */ public boolean readBoolean() throws IOException { final int limit = this.limit; if (limit == -1) { throw eofOnRead(); } int position; final byte[] buffer = this.buffer; if ((position = this.position++) == limit) { this.position = 1; if ((this.limit = byteInput.read(buffer)) == -1) { throw eofOnRead(); } return buffer[0] != 0; } this.position = position + 1; return buffer[position] != 0; }
/** {@inheritDoc} */ public byte readByte() throws IOException { final int limit; if ((limit = this.limit) == -1) { throw eofOnRead(); } int position; final byte[] buffer = this.buffer; if ((position = this.position++) == limit) { this.position = 1; if ((this.limit = byteInput.read(buffer)) == -1) { throw eofOnRead(); } return buffer[0]; } this.position = position + 1; return buffer[position]; }
/** {@inheritDoc} */ public boolean readBoolean() throws IOException { final int limit = this.limit; if (limit == -1) { throw eofOnRead(); } int position; final byte[] buffer = this.buffer; if ((position = this.position++) == limit) { this.position = 1; if ((this.limit = byteInput.read(buffer)) == -1) { throw eofOnRead(); } return buffer[0] != 0; } this.position = position + 1; return buffer[position] != 0; }
/** {@inheritDoc} */ public byte readByte() throws IOException { final int limit; if ((limit = this.limit) == -1) { throw eofOnRead(); } int position; final byte[] buffer = this.buffer; if ((position = this.position++) == limit) { this.position = 1; if ((this.limit = byteInput.read(buffer)) == -1) { throw eofOnRead(); } return buffer[0]; } this.position = position + 1; return buffer[position]; }
/** {@inheritDoc} */ public boolean readBoolean() throws IOException { final int limit = this.limit; if (limit == -1) { throw eofOnRead(); } int position; final byte[] buffer = this.buffer; if ((position = this.position++) == limit) { this.position = 1; if ((this.limit = byteInput.read(buffer)) == -1) { throw eofOnRead(); } return buffer[0] != 0; } this.position = position + 1; return buffer[position] != 0; }
/** * Read an unsigned byte directly. * * @return the unsigned byte * @throws IOException if an error occurs */ protected int readUnsignedByteDirect() throws IOException { final int limit; if ((limit = this.limit) == -1) { throw eofOnRead(); } int position; final byte[] buffer = this.buffer; if ((position = this.position++) == limit) { this.position = 1; if ((this.limit = byteInput.read(buffer)) == -1) { throw eofOnRead(); } return buffer[0] & 0xff; } return buffer[position] & 0xff; }
/** * Read an unsigned byte directly. * * @return the unsigned byte * @throws IOException if an error occurs */ protected int readUnsignedByteDirect() throws IOException { final int limit; if ((limit = this.limit) == -1) { throw eofOnRead(); } int position; final byte[] buffer = this.buffer; if ((position = this.position++) == limit) { this.position = 1; if ((this.limit = byteInput.read(buffer)) == -1) { throw eofOnRead(); } return buffer[0] & 0xff; } return buffer[position] & 0xff; }
/** * Read an unsigned byte directly. * * @return the unsigned byte * @throws IOException if an error occurs */ protected int readUnsignedByteDirect() throws IOException { final int limit; if ((limit = this.limit) == -1) { throw eofOnRead(); } int position; final byte[] buffer = this.buffer; if ((position = this.position++) == limit) { this.position = 1; if ((this.limit = byteInput.read(buffer)) == -1) { throw eofOnRead(); } return buffer[0] & 0xff; } return buffer[position] & 0xff; }
/** * Read an unsigned byte directly. * * @return the unsigned byte * @throws IOException if an error occurs */ protected int readUnsignedByteDirect() throws IOException { final int limit; if ((limit = this.limit) == -1) { throw eofOnRead(); } int position; final byte[] buffer = this.buffer; if ((position = this.position++) == limit) { this.position = 1; if ((this.limit = byteInput.read(buffer)) == -1) { throw eofOnRead(); } return buffer[0] & 0xff; } return buffer[position] & 0xff; }
/** * Read an unsigned byte directly. * * @return the unsigned byte * @throws IOException if an error occurs */ protected int readUnsignedByteDirect() throws IOException { final int limit; if ((limit = this.limit) == -1) { throw eofOnRead(); } int position; final byte[] buffer = this.buffer; if ((position = this.position++) == limit) { this.position = 1; if ((this.limit = byteInput.read(buffer)) == -1) { throw eofOnRead(); } return buffer[0] & 0xff; } return buffer[position] & 0xff; }
/** {@inheritDoc} */ public void readFully(final byte[] b, int off, int len) throws IOException { if (limit == -1) { throw eofOnRead(); } final int position = this.position; int remaining = limit - position; if (len > remaining) { if (remaining > 0) { System.arraycopy(buffer, position, b, off, remaining); limit = this.position = 0; off += remaining; len -= remaining; } final ByteInput byteInput = this.byteInput; do { remaining = byteInput.read(b, off, len); if (remaining == -1) { throw eofOnRead(); } off += remaining; len -= remaining; } while (len != 0); } else try { System.arraycopy(buffer, position, b, off, len); this.position = position + len; } catch (NullPointerException e) { throw eofOnRead(); } }