public int bytesBefore(int length, byte value) { checkReadableBytes(length); return bytesBefore(readerIndex(), length, value); }
public int writableBytes() { return capacity() - writerIndex; }
public ChannelBuffer copy() { return copy(readerIndex, readableBytes()); }
public short readShort() { checkReadableBytes(2); short v = getShort(readerIndex); readerIndex += 2; return v; }
public void readBytes(OutputStream out, int length) throws IOException { checkReadableBytes(length); getBytes(readerIndex, out, length); readerIndex += length; }
public int readInt() { checkReadableBytes(4); int v = getInt(readerIndex); readerIndex += 4; return v; }
public int bytesBefore(ChannelBufferIndexFinder indexFinder) { return bytesBefore(readerIndex(), readableBytes(), indexFinder); }
public ChannelBuffer readBytes(int length) { checkReadableBytes(length); if (length == 0) { return ChannelBuffers.EMPTY_BUFFER; } ChannelBuffer buf = factory().getBuffer(order(), length); buf.writeBytes(this, readerIndex, length); readerIndex += length; return buf; }
public long readLong() { checkReadableBytes(8); long v = getLong(readerIndex); readerIndex += 8; return v; }
public int readUnsignedMedium() { checkReadableBytes(3); int v = getUnsignedMedium(readerIndex); readerIndex += 3; return v; }
public void getBytes(int index, byte[] dst) { getBytes(index, dst, 0, dst.length); }
public short getUnsignedByte(int index) { return (short) (getByte(index) & 0xFF); }
public long getUnsignedInt(int index) { return getInt(index) & 0xFFFFFFFFL; }
public char getChar(int index) { return (char) getShort(index); }
public double getDouble(int index) { return Double.longBitsToDouble(getLong(index)); }
public void readBytes(byte[] dst, int dstIndex, int length) { checkReadableBytes(length); getBytes(readerIndex, dst, dstIndex, length); readerIndex += length; }
public int bytesBefore(byte value) { return bytesBefore(readerIndex(), readableBytes(), value); }
public int bytesBefore(int index, int length, ChannelBufferIndexFinder indexFinder) { if (index < 0 || length < 0 || index + length > capacity()) { throw new IndexOutOfBoundsException(); } int endIndex = indexOf(index, index + length, indexFinder); if (endIndex < 0) { return -1; } return endIndex - index; }
public void getBytes(int index, ChannelBuffer dst) { getBytes(index, dst, dst.writableBytes()); }