/** * Fill in our byte buffer if we're out of space by reading the next protocol buffer object. * * @throws IOException If {@link * com.google.protobuf.MessageLite#writeDelimitedTo(java.io.OutputStream)} fails */ private void fillBytes() throws IOException { if (currentBytes.available() > 0) { return; } currentBytes.reset(); while (protoBufferIterator.hasNext() && currentBytes.size() <= 1000) { protoBufferIterator.next().writeDelimitedTo(currentBytes); } }
@Override public int available() { return currentBytes.available(); }