Package org.renjin.primitives.io.connections

Examples of org.renjin.primitives.io.connections.Connection


        } catch (IOException e) {
          throw new EvalException("I/O Exception occurred during parse: " + e.getMessage());
        }
      }
    } else if(file.inherits("connection")) {
      Connection conn = Connections.getConnection(context, file);
      Reader reader = new InputStreamReader(conn.getInputStream());
      ExpressionVector result = RParser.parseSource(reader);
      Iterables.addAll(expressions, result);
    }

    return new ExpressionVector(expressions);
View Full Code Here


      boolean ascii,
      SEXP version,
      Environment envir,
      boolean evalPromises) throws IOException {
   
    Connection con = Connections.getConnection(context, connHandle);
    boolean wasOpen = con.isOpen();
    if(!wasOpen) {
      con.open(new OpenSpec("wb"));
    }
   
    if(!con.canWrite()) {
      throw new EvalException("connection not open for writing");
    }
    if(ascii) {
      throw new EvalException("ascii serialization not implemented");
    }
    PairList.Builder list = new PairList.Builder();
    for(String name : names) {
      SEXP value = envir.getVariable(name);
      if(value == Symbol.UNBOUND_VALUE) {
        throw new EvalException("object '%s' not found", name);
      }
      if(evalPromises) {
        value = value.force(context);
      }
      list.add(name, value);
    }
   
    RDataWriter writer = new RDataWriter(context, con.getOutputStream());
    writer.save(list.build());
   
    if (!wasOpen) {
      con.close();
    }
  }
View Full Code Here

TOP

Related Classes of org.renjin.primitives.io.connections.Connection

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.