aboutsummaryrefslogtreecommitdiffstats
path: root/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java
diff options
context:
space:
mode:
authorVlad Dumitrescu <[email protected]>2014-02-11 14:17:07 +0100
committerVlad Dumitrescu <[email protected]>2014-02-11 19:48:53 +0100
commit2b4582d2154b157092fc05c387655e5426ed7d8e (patch)
tree3225373219ff8ffe7450d4e3ad39290482eafe77 /lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java
parentd7d240bc3d03cf708f6feaf20efac1addcd76242 (diff)
downloadotp-2b4582d2154b157092fc05c387655e5426ed7d8e.tar.gz
otp-2b4582d2154b157092fc05c387655e5426ed7d8e.tar.bz2
otp-2b4582d2154b157092fc05c387655e5426ed7d8e.zip
jinterface: implement support for maps
The API and implementation are simplistic, like for lists and tuples, using arrays and without any connection to java.util.Map.
Diffstat (limited to 'lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java')
-rw-r--r--lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java
index 9dc1728346..0d1342d796 100644
--- a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java
+++ b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java
@@ -1202,6 +1202,9 @@ public class OtpInputStream extends ByteArrayInputStream {
case OtpExternal.newRefTag:
return new OtpErlangRef(this);
+ case OtpExternal.mapTag:
+ return new OtpErlangMap(this);
+
case OtpExternal.portTag:
return new OtpErlangPort(this);
@@ -1244,4 +1247,21 @@ public class OtpInputStream extends ByteArrayInputStream {
throw new OtpErlangDecodeException("Uknown data type: " + tag);
}
}
+
+ public int read_map_head() throws OtpErlangDecodeException {
+ int arity = 0;
+ final int tag = read1skip_version();
+
+ // decode the map header and get arity
+ switch (tag) {
+ case OtpExternal.mapTag:
+ arity = read4BE();
+ break;
+
+ default:
+ throw new OtpErlangDecodeException("Not valid map tag: " + tag);
+ }
+
+ return arity;
+ }
}