Package erjang

Examples of erjang.EBinary.byteSize()


      byte[] byteArray = b.getByteArray();
      if (b != null && b.byteAt(0) == '/') {
       
        byte[] raw = byteArray;
        int end = raw.length - 1;
        for (int i = b.byteSize()-1; i > 0; i--) {
          if (b.byteAt(i*8) == '/') {
            end = i;
            break;
          }
        } 
View Full Code Here


  }
 
  @BIF
  public static ESmall external_size(EObject obj) {
    EBinary bin = term_to_binary(obj);
    return ERT.box(bin.byteSize());
  }

  @BIF static ETuple2 split_binary(EObject bin, EObject idx) {
    EBitString b;
    ESmall i;
View Full Code Here

    if ((bin = obj.testBinary()) == null)
      throw ERT.badarg(obj);

    // remove leading +
    int off = 0;
    if (bin.byteSize() > 0) {
      if (bin.byteAt(0) == '+') {
        off += 1;
      }
    }
   
View Full Code Here

    if ((bin = obj.testBinary()) == null || (rdx = radix.testSmall()) == null)
      throw ERT.badarg(obj, radix);

    // remove leading +
    int off = 0;
    if (bin.byteSize() > 0) {
      if (bin.byteAt(0) == '+') {
        off += 1;
      }
    }
   
View Full Code Here

      throw ERT.badarg(obj,start,stop);

    int idx0start = s.value-1;
    int len = e.value-s.value+1;

    if (idx0start < 0 || len < 0 || (idx0start + len) > bin.byteSize())
      throw ERT.badarg(obj, start, stop);

    return EString.make(bin, idx0start, len);
  }
View Full Code Here

  @BIF
  static ESmall iolist_size(EObject val) {

    EBinary bin;
    if ((bin=val.testBinary()) != null) {
      return new ESmall(bin.byteSize());
    }
   
    EString str;
    if ((str=val.testString()) != null) {
      return new ESmall(str.length());
View Full Code Here

    {
      EBinary b;
      if ((b = o.testBinary()) == null)
        throw ERT.badarg(o);
     
      return ERT.box(b.byteSize());
    }
    return ERT.box(t.arity());
  }

  @BIF
View Full Code Here

    if ((t = o.testTuple()) != null)
      return ERT.box(t.arity());

    EBinary b;
    if ((b = o.testBinary()) != null)
      return ERT.box(b.byteSize());
   
    return null;
  }

  @BIF(type = Type.GUARD, name = "size")
View Full Code Here

      ESmall start1 = start.testSmall();
      if (bin1 == null || start1 == null) {
        return null;
      }
     
      return binary_part_guard(bin, start, ERT.box( bin1.byteSize() - start1.value ));
    }
   
    @BIF(name="binary_part", type=Type.GUARD)
    public static EObject binary_part_guard(EObject bin, EObject start, EObject length) {
      EBinary bin1 = bin.testBinary();
View Full Code Here

      if (bin1 == null || start1 == null || length == null) {
        return null;
      }
     
      if (start1.value < 0
          || (start1.value + length1.value) > bin1.byteSize()
        || length1.value < 0) {
        return null;
      }
 
      return bin1.substring(start1.value * 8, length1.value * 8);
 
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.