Mercurial > hg > Members > sugi > MessagePack-java
changeset 4:d5cc3aef5b74
add getSerializedByteArray Method
author | sugi |
---|---|
date | Fri, 09 Jan 2015 14:12:10 +0900 |
parents | e11de4397136 |
children | efe621b1dba9 |
files | src/main/java/org/msgpack/unpacker/MessagePackBufferUnpacker.java src/main/java/org/msgpack/unpacker/MessagePackUnpacker.java |
diffstat | 2 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/org/msgpack/unpacker/MessagePackBufferUnpacker.java Sat Oct 18 22:20:05 2014 +0900 +++ b/src/main/java/org/msgpack/unpacker/MessagePackBufferUnpacker.java Fri Jan 09 14:12:10 2015 +0900 @@ -17,10 +17,12 @@ // package org.msgpack.unpacker; +import java.io.IOException; import java.nio.ByteBuffer; import org.msgpack.MessagePack; import org.msgpack.io.LinkedBufferInput; +import org.msgpack.io.StreamInput; public class MessagePackBufferUnpacker extends MessagePackUnpacker implements BufferUnpacker { private static final int DEFAULT_BUFFER_SIZE = 512; // TODO default buffer @@ -104,4 +106,8 @@ ((LinkedBufferInput) in).clear(); reset(); } + + public byte[] getSerializedByteArray(int len) throws IOException { + return ((StreamInput)in).getRawByteArray(len); + } }
--- a/src/main/java/org/msgpack/unpacker/MessagePackUnpacker.java Sat Oct 18 22:20:05 2014 +0900 +++ b/src/main/java/org/msgpack/unpacker/MessagePackUnpacker.java Fri Jan 09 14:12:10 2015 +0900 @@ -682,8 +682,9 @@ public void resetReadByteCount() { in.resetReadByteCount(); } - + public byte[] getSerializedByteArray(int len) throws IOException { + byte b = getHeadByte(); return ((StreamInput)in).getRawByteArray(len); } }