From 41f0294cd6dc8aed2b3591d3ada9db8debd6a0d6 Mon Sep 17 00:00:00 2001 From: Shai Barack Date: Tue, 17 Feb 2015 09:44:48 -0800 Subject: Add reset() and position() to CodedOutputByteBufferNano. Change-Id: Ie2a9e36276ac35e10b3f8d379b5742d50a0374e9 --- .../google/protobuf/nano/CodedOutputByteBufferNano.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/javanano/src/main/java/com/google/protobuf/nano/CodedOutputByteBufferNano.java b/javanano/src/main/java/com/google/protobuf/nano/CodedOutputByteBufferNano.java index d0bc07e4..91fa3353 100644 --- a/javanano/src/main/java/com/google/protobuf/nano/CodedOutputByteBufferNano.java +++ b/javanano/src/main/java/com/google/protobuf/nano/CodedOutputByteBufferNano.java @@ -898,6 +898,23 @@ public final class CodedOutputByteBufferNano { } } + /** + * Returns the position within the internal buffer. + */ + public int position() { + return buffer.position(); + } + + /** + * Resets the position within the internal buffer to zero. + * + * @see #position + * @see #spaceLeft + */ + public void reset() { + buffer.clear(); + } + /** * If you create a CodedOutputStream around a simple flat array, you must * not attempt to write more bytes than the array has space. Otherwise, -- cgit v1.2.3