@Override public int readIndex() throws IOException { return readInt(); }
@Override public int readEnum() throws IOException { return readInt(); }
@Override public int readIndex() throws IOException { return readInt(); }
@Override public int readEnum() throws IOException { return readInt(); }
@Override public void skipBytes() throws IOException { doSkipBytes(readInt()); }
@Override public ByteBuffer readBytes(ByteBuffer old) throws IOException { int length = readInt(); ByteBuffer result; if (old != null && length <= old.capacity()) { result = old; result.clear(); } else { result = ByteBuffer.allocate(length); } doReadBytes(result.array(), result.position(), length); result.limit(length); return result; }
@Override public void skipBytes() throws IOException { doSkipBytes(readInt()); }
@Override public void skipString() throws IOException { doSkipBytes(readInt()); }
@Override public void skipString() throws IOException { doSkipBytes(readInt()); }
@Override public ByteBuffer readBytes(ByteBuffer old) throws IOException { int length = readInt(); ByteBuffer result; if (old != null && length <= old.capacity()) { result = old; result.clear(); } else { result = ByteBuffer.allocate(length); } doReadBytes(result.array(), result.position(), length); result.limit(length); return result; }
/** * Reads the count of items in the current array or map and skip those items, * if possible. If it could skip the items, keep repeating until there are no * more items left in the array or map. If items cannot be skipped (because * byte count to skip is not found in the stream) return the count of the * items found. The client needs to skip the items individually. * * @return Zero if there are no more items to skip and end of array/map is * reached. Positive number if some items are found that cannot be * skipped and the client needs to skip them individually. * @throws IOException */ private long doSkipItems() throws IOException { long result = readInt(); while (result < 0) { long bytecount = readLong(); doSkipBytes(bytecount); result = readInt(); } return result; }
/** * Reads the count of items in the current array or map and skip those items, * if possible. If it could skip the items, keep repeating until there are no * more items left in the array or map. If items cannot be skipped (because * byte count to skip is not found in the stream) return the count of the * items found. The client needs to skip the items individually. * * @return Zero if there are no more items to skip and end of array/map is * reached. Positive number if some items are found that cannot be * skipped and the client needs to skip them individually. * @throws IOException */ private long doSkipItems() throws IOException { long result = readInt(); while (result < 0) { long bytecount = readLong(); doSkipBytes(bytecount); result = readInt(); } return result; }
@Override public Utf8 readString(Utf8 old) throws IOException { int length = readInt(); Utf8 result = (old != null ? old : new Utf8()); result.setByteLength(length); if (0 != length) { doReadBytes(result.getBytes(), 0, length); } return result; }
@Override public void skipInt() throws IOException { // ints use variable-length zigzagging; alas, no native skipping _decoder.readInt(); }
@Override public int readEnum() throws IOException { return readInt(); }
@Override public int readEnum() throws IOException { return readInt(); }
@Override public int decodeInt() throws IOException { return _decoder.readInt(); }
@Override public int readEnum() throws IOException { return readInt(); }
@Override public void skipBytes() throws IOException { doSkipBytes(readInt()); }
@Override public Utf8 readString(Utf8 old) throws IOException { int length = readInt(); Utf8 result = (old != null ? old : new Utf8()); result.setLength(length); doReadBytes(result.getBytes(), 0, length); return result; }