Examples of PushbackBufferedReader


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

  @Internal
  public static StringVector readTableHead(@Current Context context,
     SEXP conn, int nLines, String commentChar, int blankLinesSkip, String quote, String sep) throws IOException {
   
    PushbackBufferedReader reader = Connections.getConnection(context, conn).getReader();
   
    StringVector.Builder head = new StringVector.Builder();
    String line;
    while( nLines > 0 && (line=reader.readLine())!=null) {
      head.add(line);
      nLines -- ;
    }
    return head.build();
  }
View Full Code Here

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

                            String commentChar,
                            boolean allowEscapes,
                            String encoding) throws IOException {
   
   
    PushbackBufferedReader lineReader;
    if(file instanceof StringVector) {
      String fileName = ((StringVector) file).getElementAsString(0);
      if(fileName.length() == 0) {
        lineReader = context.getSession().getConnectionTable().getStdin().getReader();
      } else {
        SEXP fileConn = Connections.file(context,fileName,"o",true,encoding,false);
        lineReader = Connections.getConnection(context, fileConn).getReader();
      }
    } else {
      lineReader = Connections.getConnection(context, file).getReader();
    }

    Splitter splitter;
    if(Strings.isNullOrEmpty(seperator)) {
      splitter = new WhitespaceSplitter(quote);
    } else {
      splitter = new CharSplitter(quote, seperator);
    }
   
    Scanner scanner;
    if(what instanceof ListVector) {
      scanner = new ListReader((ListVector)what, splitter);
    } else {
      scanner = new ScalarReader(getAtomicScanner(what), splitter);
    }

    String line;
    int linesRead = 0;
    int linesSkipped = 0;
    while( (linesRead < nlines || nlines <= 0) &&
            (line=lineReader.readLine())!=null) {
      if (linesSkipped < skip) {
        linesSkipped++;
        continue;
      }
      linesRead ++;
View Full Code Here

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

    }
   
    int rowIndex = 0;
    boolean lastLineWasBlank = false;
    String line;
    PushbackBufferedReader reader = Connections.getConnection(context, conn).getReader();
    Cell lastCell = null;
    while((line=reader.readLine())!=null) {
      boolean lineIsBlank = line.trim().length() == 0;
      if(lineIsBlank) {
        if(!lastLineWasBlank) {
          rowIndex++;
        }
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.