summaryrefslogtreecommitdiff
path: root/java/src
diff options
context:
space:
mode:
authorfrsyuki <frsyuki@users.sourceforge.jp>2010-05-20 06:18:32 +0900
committerfrsyuki <frsyuki@users.sourceforge.jp>2010-05-20 06:18:32 +0900
commit985c31b3786cb3206eb299160b10a53cf237dc00 (patch)
treedf39c50fdf50711152308d213421d28cde5898a5 /java/src
parent135a9f558600ddbd4cd0d07a57ae1f7fb5b8634a (diff)
downloadmsgpack-python-985c31b3786cb3206eb299160b10a53cf237dc00.tar.gz
java: add Unpacker.wrap method
Diffstat (limited to 'java/src')
-rw-r--r--java/src/main/java/org/msgpack/Unpacker.java36
1 files changed, 23 insertions, 13 deletions
diff --git a/java/src/main/java/org/msgpack/Unpacker.java b/java/src/main/java/org/msgpack/Unpacker.java
index 4d8da7b..7fd6fcd 100644
--- a/java/src/main/java/org/msgpack/Unpacker.java
+++ b/java/src/main/java/org/msgpack/Unpacker.java
@@ -40,7 +40,7 @@ public class Unpacker implements Iterable<Object> {
protected int bufferReserveSize;
protected InputStream stream;
- class BufferedUnpackerMixin extends BufferedUnpackerImpl {
+ final class BufferedUnpackerMixin extends BufferedUnpackerImpl {
boolean fill() throws IOException {
if(stream == null) {
return false;
@@ -109,6 +109,16 @@ public class Unpacker implements Iterable<Object> {
bufferConsumed(length);
}
+ public void wrap(byte[] buffer) {
+ wrap(buffer, 0, buffer.length);
+ }
+
+ public void wrap(byte[] buffer, int offset, int length) {
+ impl.buffer = buffer;
+ impl.offset = offset;
+ impl.filled = length;
+ }
+
public boolean fill() throws IOException {
return impl.fill();
}
@@ -226,51 +236,51 @@ public class Unpacker implements Iterable<Object> {
}
- final public byte unpackByte() throws IOException, MessageTypeException {
+ public byte unpackByte() throws IOException, MessageTypeException {
return impl.unpackByte();
}
- final public short unpackShort() throws IOException, MessageTypeException {
+ public short unpackShort() throws IOException, MessageTypeException {
return impl.unpackShort();
}
- final public int unpackInt() throws IOException, MessageTypeException {
+ public int unpackInt() throws IOException, MessageTypeException {
return impl.unpackInt();
}
- final public long unpackLong() throws IOException, MessageTypeException {
+ public long unpackLong() throws IOException, MessageTypeException {
return impl.unpackLong();
}
- final public float unpackFloat() throws IOException, MessageTypeException {
+ public float unpackFloat() throws IOException, MessageTypeException {
return impl.unpackFloat();
}
- final public double unpackDouble() throws IOException, MessageTypeException {
+ public double unpackDouble() throws IOException, MessageTypeException {
return impl.unpackDouble();
}
- final public Object unpackNull() throws IOException, MessageTypeException {
+ public Object unpackNull() throws IOException, MessageTypeException {
return impl.unpackNull();
}
- final public boolean unpackBoolean() throws IOException, MessageTypeException {
+ public boolean unpackBoolean() throws IOException, MessageTypeException {
return impl.unpackBoolean();
}
- final public int unpackArray() throws IOException, MessageTypeException {
+ public int unpackArray() throws IOException, MessageTypeException {
return impl.unpackArray();
}
- final public int unpackMap() throws IOException, MessageTypeException {
+ public int unpackMap() throws IOException, MessageTypeException {
return impl.unpackMap();
}
- final public int unpackRaw() throws IOException, MessageTypeException {
+ public int unpackRaw() throws IOException, MessageTypeException {
return impl.unpackRaw();
}
- final public byte[] unpackRawBody(int length) throws IOException, MessageTypeException {
+ public byte[] unpackRawBody(int length) throws IOException, MessageTypeException {
return impl.unpackRawBody(length);
}