Package com.ericsson.otp.erlang

Examples of com.ericsson.otp.erlang.OtpErlangBitstr


      return singleton;
    }

    @Override
    public void dump(OtpErlangObject obj, StringBuffer resultHolder) {
      OtpErlangBitstr bitStr = (OtpErlangBitstr) obj;
      resultHolder.append("<< ");
      byte[] bitStringData = bitStr.binaryValue();
      if (bitStr.size() != bitStringData.length)
        throw new IllegalArgumentException(
            "the number of bits in the string is not divisible by 8, conversion cannot be accurately performed");
      boolean first = true;
      for (byte b : bitStringData) {
        if (!first)
View Full Code Here


            "the length of bit string should be divisible by 8");
      byte[] bitData = new byte[data.size()];
      int i = 0;
      for (Byte b : data)
        bitData[i++] = b.byteValue();
      return new OtpErlangBitstr(bitData);
    }
View Full Code Here

      return singleton;
    }

    @Override
    public void dump(OtpErlangObject obj, StringBuffer resultHolder) {
      OtpErlangBitstr bitStr = (OtpErlangBitstr) obj;
      resultHolder.append("<< ");
      byte[] bitStringData = bitStr.binaryValue();
      if (bitStr.size() != bitStringData.length)
        throw new IllegalArgumentException(
            "the number of bits in the string is not divisible by 8, conversion cannot be accurately performed");
      boolean first = true;
      for (byte b : bitStringData) {
        if (!first)
View Full Code Here

            "the length of bit string should be divisible by 8");
      byte[] bitData = new byte[data.size()];
      int i = 0;
      for (Byte b : data)
        bitData[i++] = b.byteValue();
      return new OtpErlangBitstr(bitData);
    }
View Full Code Here

  }

  @Test
  public void testDumpBitStr0()
  {
    OtpErlangBitstr str = (OtpErlangBitstr) runner.evaluateString("<<  >>");
    Assert.assertEquals("<< >>",ErlangLabel.dumpErlangObject(str));
  }
View Full Code Here

  }
 
  @Test
  public void testDumpBitStr1()
  {
    OtpErlangBitstr str = (OtpErlangBitstr) runner.evaluateString("<< 1:4,0:4/integer-unit:1,1:1,0:7 >>");
    Assert.assertEquals("<< 16, 128>>",ErlangLabel.dumpErlangObject(str));
  }
View Full Code Here

  }
 
  @Test
  public void testDumpBitStr2()
  {
    OtpErlangBitstr str = new OtpErlangBitstr(new byte[]{-128,8},0);
    Assert.assertEquals("<< 128, 8>>",ErlangLabel.dumpErlangObject(str));
  }
View Full Code Here

  }
 
  @Test
  public void testDumpBitStrFail()
  {
    final OtpErlangBitstr str = (OtpErlangBitstr) runner.evaluateString("<< 1:4,0:4/integer-unit:1,1:1 >>");
    checkForCorrectException(new whatToRun() { public @Override void run() {
      ErlangLabel.dumpErlangObject(str);
    }},IllegalArgumentException.class,"is not divisible by 8");
  }
View Full Code Here

      return singleton;
    }

    @Override
    public void dump(OtpErlangObject obj, StringBuffer resultHolder) {
      OtpErlangBitstr bitStr = (OtpErlangBitstr) obj;
      resultHolder.append("<< ");
      byte[] bitStringData = bitStr.binaryValue();
      if (bitStr.size() != bitStringData.length)
        throw new IllegalArgumentException(
            "the number of bits in the string is not divisible by 8, conversion cannot be accurately performed");
      boolean first = true;
      for (byte b : bitStringData) {
        if (!first)
View Full Code Here

            "the length of bit string should be divisible by 8");
      byte[] bitData = new byte[data.size()];
      int i = 0;
      for (Byte b : data)
        bitData[i++] = b.byteValue();
      return new OtpErlangBitstr(bitData);
    }
View Full Code Here

TOP

Related Classes of com.ericsson.otp.erlang.OtpErlangBitstr

Copyright © 2018 www.massapicom. 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.