Package com.ericsson.otp.erlang

Examples of com.ericsson.otp.erlang.OtpOutputStream.toByteArray()


    public void sublist_5() throws TermParserException, IOException {
        final OtpErlangList r = (OtpErlangList) termParser.parse("[1,2,3,4]");
        final OtpErlangObject ss = r.getNthTail(2);
        final OtpOutputStream out = new OtpOutputStream();
        ss.encode(out);
        final byte[] contents1 = out.toByteArray();
        out.reset();
        final OtpErlangList s = (OtpErlangList) termParser.parse("[3,4]");
        s.encode(out);
        final byte[] contents2 = out.toByteArray();
        out.close();
View Full Code Here


        ss.encode(out);
        final byte[] contents1 = out.toByteArray();
        out.reset();
        final OtpErlangList s = (OtpErlangList) termParser.parse("[3,4]");
        s.encode(out);
        final byte[] contents2 = out.toByteArray();
        out.close();

        Assert.assertEquals(contents2.length, contents1.length);
        for (int i = 0; i < contents1.length; i++) {
            Assert.assertEquals(contents2[i], contents1[i]);
View Full Code Here

    public void sublist_6() throws TermParserException, IOException {
        final OtpErlangList r = (OtpErlangList) termParser.parse("[1,2,3|4]");
        final OtpErlangObject ss = r.getNthTail(2);
        final OtpOutputStream out = new OtpOutputStream();
        ss.encode(out);
        final byte[] contents1 = out.toByteArray();
        out.reset();
        final OtpErlangList s = (OtpErlangList) termParser.parse("[3|4]");
        s.encode(out);
        final byte[] contents2 = out.toByteArray();
        out.close();
View Full Code Here

        ss.encode(out);
        final byte[] contents1 = out.toByteArray();
        out.reset();
        final OtpErlangList s = (OtpErlangList) termParser.parse("[3|4]");
        s.encode(out);
        final byte[] contents2 = out.toByteArray();
        out.close();

        Assert.assertEquals(contents2.length, contents1.length);
        for (int i = 0; i < contents1.length; i++) {
            Assert.assertEquals(contents2[i], contents1[i]);
View Full Code Here

      if (!output.equals(out)) {
    fail("toString mismatch " + output + " <> " + out, err);
      }

      final OtpOutputStream os = new OtpOutputStream(map);
      final byte[] outArray0 = os.toByteArray();
      final byte[] outArray = new byte[outArray0.length + 1];
      System.arraycopy(outArray0, 0, outArray, 1, outArray0.length);
      outArray[0] = (byte) 131;
      if (!Arrays.equals(in, outArray)) {
    fail("encode error " + Arrays.toString(outArray), err);
View Full Code Here

        @SuppressWarnings("resource")
    final OtpOutputStream oos = new OtpOutputStream();
    oos.write1(OtpExternal.versionTag);
    oos.write_compressed(i);
    final OtpErlangBinary o =
        new OtpErlangBinary(oos.toByteArray());
    return o;
      } else if (atomValue.equals("bigint")
           && i instanceof OtpErlangLong) {
    final OtpErlangLong l = (OtpErlangLong) i;
    final int w = l.signum() * l.bitLength();
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.