kidok / protobuf

Automatically exported from code.google.com/p/protobuf
0 stars 0 forks source link

ByteString: Method For Chunking #614

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The internal usage of RopeByteString (and RopeInputStream) is particularly 
interesting. Alongside this, it would be very handy if ByteString exposed a 
public method that is the reverse of:
public static ByteString copyFrom(Iterable<ByteString> byteStrings);

Essentially, it would be for chunking a ByteString into several smaller chunks 
and returning those chunks in a list.
Something along the lines of:
public static List<ByteString> chunkify(ByteString s, int chunkSize);

...where all but the final chunk are guaranteed to be of size 'chunkSize'.

Original issue reported on code.google.com by vi...@umich.edu on 12 Mar 2014 at 7:27