@Override public short readShort() { ensureAvailable(SIZE_OF_SHORT); short v = buffer.getShort(bufferPosition); bufferPosition += SIZE_OF_SHORT; return v; }
@Override public float readFloat() { ensureAvailable(SIZE_OF_FLOAT); float v = buffer.getFloat(bufferPosition); bufferPosition += SIZE_OF_FLOAT; return v; }
@Override public short readShort() { ensureAvailable(SIZE_OF_SHORT); short v = buffer.getShort(bufferPosition); bufferPosition += SIZE_OF_SHORT; return v; }
@Override public float readFloat() { ensureAvailable(SIZE_OF_FLOAT); float v = buffer.getFloat(bufferPosition); bufferPosition += SIZE_OF_FLOAT; return v; }
@Override public int readInt() { ensureAvailable(SIZE_OF_INT); int v = buffer.getInt(bufferPosition); bufferPosition += SIZE_OF_INT; return v; }
@Override public int readInt() { ensureAvailable(SIZE_OF_INT); int v = buffer.getInt(bufferPosition); bufferPosition += SIZE_OF_INT; return v; }
@Override public long readLong() { ensureAvailable(SIZE_OF_LONG); long v = buffer.getLong(bufferPosition); bufferPosition += SIZE_OF_LONG; return v; }
@Override public double readDouble() { ensureAvailable(SIZE_OF_DOUBLE); double v = buffer.getDouble(bufferPosition); bufferPosition += SIZE_OF_DOUBLE; return v; }
@Override public long readLong() { ensureAvailable(SIZE_OF_LONG); long v = buffer.getLong(bufferPosition); bufferPosition += SIZE_OF_LONG; return v; }
@Override public double readDouble() { ensureAvailable(SIZE_OF_DOUBLE); double v = buffer.getDouble(bufferPosition); bufferPosition += SIZE_OF_DOUBLE; return v; }
@Override public int read() { if (position() >= globalLength) { return -1; } ensureAvailable(SIZE_OF_BYTE); int result = buffer.getByte(bufferPosition) & 0xFF; bufferPosition++; return result; }
@Override public int read() { if (position() >= globalLength) { return -1; } ensureAvailable(SIZE_OF_BYTE); int result = buffer.getByte(bufferPosition) & 0xFF; bufferPosition++; return result; }
@Override public void readBytes(Slice destination, int destinationIndex, int length) { checkBound(position() + length, globalLength, "End of stream"); while (length > 0) { int bytesToRead = min(available(), length); buffer.getBytes(bufferPosition, destination, destinationIndex, bytesToRead); bufferPosition += bytesToRead; length -= bytesToRead; destinationIndex += bytesToRead; ensureAvailable(min(length, buffer.length())); } }
@Override public void readBytes(OutputStream out, int length) throws IOException { checkBound(position() + length, globalLength, "End of stream"); while (length > 0) { int bytesToRead = min(available(), length); buffer.getBytes(bufferPosition, out, bytesToRead); bufferPosition += bytesToRead; length -= bytesToRead; ensureAvailable(min(length, buffer.length())); } }
@Override public void readBytes(Slice destination, int destinationIndex, int length) { checkBound(position() + length, globalLength, "End of stream"); while (length > 0) { int bytesToRead = min(available(), length); buffer.getBytes(bufferPosition, destination, destinationIndex, bytesToRead); bufferPosition += bytesToRead; length -= bytesToRead; destinationIndex += bytesToRead; ensureAvailable(min(length, buffer.length())); } }
@Override public void readBytes(byte[] destination, int destinationIndex, int length) { checkBound(position() + length, globalLength, "End of stream"); while (length > 0) { int bytesToRead = min(available(), length); buffer.getBytes(bufferPosition, destination, destinationIndex, bytesToRead); bufferPosition += bytesToRead; length -= bytesToRead; destinationIndex += bytesToRead; ensureAvailable(min(length, buffer.length())); } }
@Override public void readBytes(byte[] destination, int destinationIndex, int length) { checkBound(position() + length, globalLength, "End of stream"); while (length > 0) { int bytesToRead = min(available(), length); buffer.getBytes(bufferPosition, destination, destinationIndex, bytesToRead); bufferPosition += bytesToRead; length -= bytesToRead; destinationIndex += bytesToRead; ensureAvailable(min(length, buffer.length())); } }
@Override public void readBytes(OutputStream out, int length) throws IOException { checkBound(position() + length, globalLength, "End of stream"); while (length > 0) { int bytesToRead = min(available(), length); buffer.getBytes(bufferPosition, out, bytesToRead); bufferPosition += bytesToRead; length -= bytesToRead; ensureAvailable(min(length, buffer.length())); } }