On Mon, Aug 5, 2013 at 3:23 PM, V.B. <[email protected]> wrote:

> Greetings all,
>     We are using version 2.5. What is the most efficient way (*i.e.*single 
> copy operation, no extra byte arrays) to construct a ByteString from
> a specific number of bytes in an InputStream? The various versions of
> ByteString.readFrom() drain the stream completely, which is not what we
> need; any data past *N* bytes should remain in the stream. The
> ByteString.readChunk() method looks like it will work if we simply give
> it *N* as the chunkSize parameter. Unfortunately, ByteString.readChunk()is 
> declared private, so that method is not currently an option. Is there
> another option that I just haven't found in the source code yet?
>
How about create an wrapper InputStream that only reads N bytes from the
original InputStream and provide the wrapper to BytesString.readFrom()?


>
> (Thanks for taking the time to read this question.)
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to