Package erjang

Examples of erjang.EInputStream


      throw new IOException("File length is off - stated as "+(stated_length+8)+", is "+actual_file_size);

    byte[] data = new byte[stated_length-4];
    in.readFully(data);

    this.in = new EInputStream(data);
    }
View Full Code Here


    }

    public void readLiteralSection() throws IOException {
    if (log.isLoggable(Level.FINE)) log.fine("readLiteralSection");
    final byte[] buf = in.read_size_and_inflate();
    final EInputStream is = new EInputStream(buf);
    int nLiterals = is.read4BE();
    if (log.isLoggable(Level.FINE)) log.fine("Number of literals: "+nLiterals);
    literals = new EObject[nLiterals];
    for (int i=0; i<nLiterals; i++) {
      int lit_length = is.read4BE();
      int pos_before_lit = is.getPos();
      literals[i] = is.read_any();
      if (log.isLoggable(Level.FINE)) log.fine("- #"+i+": "+literals[i]);
      int pos_after_lit = is.getPos();
      assert(pos_after_lit == pos_before_lit + lit_length);
    }
    }
View Full Code Here

  @BIF
  public static EObject binary_to_term(EObject arg) {
    EBinary bin;
    if ((bin=arg.testBinary()) == null) throw ERT.badarg(arg);
    EInputStream in = bin.getInputStream();
    try {
      EObject val = in.read_any();
      //System.out.println("DECODED:"+val);
      return val;
    } catch (IOException e) {
      throw new ErlangError(ERT.am_badarg, e, arg);
    }
View Full Code Here

  @BIF
  public static EObject binary_to_term(EObject arg, EObject opts) {
    EBinary bin; ESeq options;
    if ((bin=arg.testBinary()) == null || (options = opts.testSeq()) == null) throw ERT.badarg(arg);
    EInputStream in = bin.getInputStream();
    if (!options.isNil()) {
      if (options.head() == am_safe) {
        in.setSafe(true);
      }
    }
    try {
      EObject val = in.read_any();
      return val;
    } catch (ErlangError e) {
      throw new ErlangError(ERT.am_badarg, e, arg);
    } catch (IOException e) {
      throw new ErlangError(ERT.am_badarg, e, arg);
View Full Code Here

TOP

Related Classes of erjang.EInputStream

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.