Mercurial > hg > Members > sugi > MessagePack-java
changeset 1:769ba8da0840
add get serialized ByteArray method
author | one |
---|---|
date | Sat, 18 Oct 2014 21:37:12 +0900 (2014-10-18) |
parents | cb825acd883a |
children | e59e792cf718 |
files | src/main/java/org/msgpack/io/StreamInput.java src/main/java/org/msgpack/unpacker/MessagePackUnpacker.java |
diffstat | 2 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/org/msgpack/io/StreamInput.java Sat Oct 18 15:06:15 2014 +0900 +++ b/src/main/java/org/msgpack/io/StreamInput.java Sat Oct 18 21:37:12 2014 +0900 @@ -111,4 +111,10 @@ public void close() throws IOException { in.close(); } + + public byte[] getRawByteArray(int len) throws IOException { + byte[] b = new byte[len]; + read(b, 0, len); + return b; + } }
--- a/src/main/java/org/msgpack/unpacker/MessagePackUnpacker.java Sat Oct 18 15:06:15 2014 +0900 +++ b/src/main/java/org/msgpack/unpacker/MessagePackUnpacker.java Sat Oct 18 21:37:12 2014 +0900 @@ -682,4 +682,8 @@ public void resetReadByteCount() { in.resetReadByteCount(); } + + public byte[] getSerializedByteArray(int len) throws IOException { + return ((StreamInput)in).getRawByteArray(len); + } }