Examples of EBinary


Examples of erjang.EBinary

      data = str.getBytes(IO.UTF8);      
    } else {
      throw ERT.badarg(obj, enc);     
    }
   
    return new EBinary(data);
  }
View Full Code Here

Examples of erjang.EBinary

    return new EBinary(data);
  }

  @BIF
  public static EAtom binary_to_atom(EObject obj, EObject enc) {
    EBinary bi = obj.testBinary();
    EAtom en = enc.testAtom();
    if (bi == null || en == null) {
      throw ERT.badarg(obj, enc);
    }

    byte[] data = bi.getByteArray();
    if (en == ERT.am_latin1) {
      return EAtom.intern( new String(data, IO.ISO_LATIN_1) );
    } else if (en == ERT.am_utf8 || en == ERT.am_unicode) {
      return EAtom.intern( new String(data, IO.UTF8) );
    } else {
View Full Code Here

Examples of erjang.EBinary

    }
  }

  @BIF
  public static EAtom binary_to_existing_atom(EObject obj, EObject enc) {
    EBinary bi = obj.testBinary();
    EAtom en = enc.testAtom();
    if (bi == null || en == null) {
      throw ERT.badarg(obj, enc);
    }

    String name;
    byte[] data = bi.getByteArray();
    if (en == ERT.am_latin1) {
      name = new String(data, IO.ISO_LATIN_1);
    } else if (en == ERT.am_utf8 || en == ERT.am_unicode) {
      name = new String(data, IO.UTF8);
    } else {
View Full Code Here

Examples of erjang.EBinary

    return EIOListVisitor.collect_bitstring(list);
  }
 
  static private class BARR extends ByteArrayOutputStream {
    EBinary asBinary() {
      return new EBinary(super.buf, 0, super.count);
    }
View Full Code Here

Examples of erjang.EBinary

          ERT.run_async(new EAsync() {
           
            @Override
            public void ready() throws Pausable {
              if (task.send_binary_data) {
                EBinary out = new EBinary(ob);
                task.output_from_driver(out);
              } else {
                EString str = EString.make(ob);
                task.output_from_driver(str);
              }
View Full Code Here

Examples of erjang.EBinary

        if (nbytes <= 0) {
          return false;
        }

        if (task.send_binary_data) {
          task.output_from_driver_b(new EBinary(data, 0, nbytes));
        } else {
          task.output_from_driver_b(EString.make(data, 0, nbytes));
        }

        return true;
View Full Code Here

Examples of erjang.EBinary

      pos += len;
    }
   
    assert(pos == length);
   
    return new EBinary(all);
  }
View Full Code Here

Examples of erjang.EBinary

  }
 
  @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

Examples of erjang.EBinary

  @BIF 
  static public EBinary float_to_binary(EObject obj) {
    EDouble value;
    if ((value = obj.testFloat()) != null) {
      return new EBinary(value.format(ERT.NIL).getBytes(IO.ISO_LATIN_1));
    }
    throw ERT.badarg(obj);
  }
View Full Code Here

Examples of erjang.EBinary

  @BIF 
  static public EBinary float_to_binary(EObject obj, EObject options) {
    EDouble value;
    if ((value = obj.testFloat()) != null) {
      return new EBinary(value.format(options).getBytes(IO.ISO_LATIN_1));
    }
    throw ERT.badarg(obj, options);
  }
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.