Examples of EBinary


Examples of erjang.EBinary

    throw ERT.badarg(obj, options);
  }

  @BIF
  public static EDouble binary_to_float(EObject obj) {
    EBinary bin = obj.testBinary();
    if (bin != null) {
      try {
        double d = Double.parseDouble( new String(bin.getByteArray(), IO.ISO_LATIN_1) );
        return new EDouble(d);
      } catch (NumberFormatException e) {
        // ignore //
      }
    }
View Full Code Here

Examples of erjang.EBinary

  @BIF
  public static final ESmall size(EObject o) {
    ETuple t;
    if ((t = o.testTuple()) == null)
    {
      EBinary b;
      if ((b = o.testBinary()) == null)
        throw ERT.badarg(o);
     
      return ERT.box(b.byteSize());
    }
    return ERT.box(t.arity());
  }
View Full Code Here

Examples of erjang.EBinary

  public static final ESmall size$g(EObject o) {
    ETuple t;
    if ((t = o.testTuple()) != null)
      return ERT.box(t.arity());

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

Examples of erjang.EBinary

  }
 
  @BIF 
  public static ETuple2 load_module(EObject mod, EObject bin) {
    EAtom name = mod.testAtom();
    EBinary binary = bin.testBinary();
    return load_module(name, binary);
  }
View Full Code Here

Examples of erjang.EBinary

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

Examples of erjang.EBinary

      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();
      ESmall start1 = start.testSmall();
      ESmall length1 = length.testSmall();
     
      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

Examples of erjang.EBinary

      }
    } finally {
      fi.close();
    }

    EBinary bin = new EBinary(data);
    return bin;
  }
View Full Code Here

Examples of erjang.EBinary

      if (((tup=term.testTuple()) != null || term.testCons() != null
          && term != ERT.NIL
          && !type.equals(ESTRING_TYPE)
          && !( tup != null && tup.arity()==5 && tup.elm(1) == ETuple.am_Elixir_Regex)
          ) {
        EBinary bin = ErlConvert.term_to_binary(term, EList.make(ErlConvert.am_compressed));
        bin.emit_const(mv);
       
        mv.visitMethodInsn(INVOKESTATIC,
            Type.getType(ErlConvert.class).getInternalName(),
            "binary_to_term",
            EUtil.getSignature(1, false));
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.