diff options
author | liujisi@google.com <liujisi@google.com@630680e5-0e50-0410-840e-4b1c322b438d> | 2010-11-02 13:14:58 +0000 |
---|---|---|
committer | liujisi@google.com <liujisi@google.com@630680e5-0e50-0410-840e-4b1c322b438d> | 2010-11-02 13:14:58 +0000 |
commit | 33165fe0d5c265c92f2a67fc2b437b567c24e294 (patch) | |
tree | 52def0850ddd2e976da238d1a437fbda79c96e44 /java/src/main/java/com/google/protobuf/ByteString.java | |
parent | 80aa23df6c63750e8cdfdcf3996fbc37d63cac61 (diff) | |
download | protobuf-33165fe0d5c265c92f2a67fc2b437b567c24e294.tar.gz protobuf-33165fe0d5c265c92f2a67fc2b437b567c24e294.tar.bz2 protobuf-33165fe0d5c265c92f2a67fc2b437b567c24e294.zip |
Submit recent changes from internal branch. See CHANGES.txt for more details.
Diffstat (limited to 'java/src/main/java/com/google/protobuf/ByteString.java')
-rw-r--r-- | java/src/main/java/com/google/protobuf/ByteString.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/java/src/main/java/com/google/protobuf/ByteString.java b/java/src/main/java/com/google/protobuf/ByteString.java index 5fade03a..91356357 100644 --- a/java/src/main/java/com/google/protobuf/ByteString.java +++ b/java/src/main/java/com/google/protobuf/ByteString.java @@ -194,6 +194,18 @@ public final class ByteString { } /** + * Copies bytes into a ByteBuffer. + * + * @param target ByteBuffer to copy into. + * @throws ReadOnlyBufferException if the {@code target} is read-only + * @throws BufferOverflowException if the {@code target}'s remaining() + * space is not large enough to hold the data. + */ + public void copyTo(ByteBuffer target) { + target.put(bytes, 0, bytes.length); + } + + /** * Copies bytes to a {@code byte[]}. */ public byte[] toByteArray() { |