@Override public void load(SolrQueryRequest req,SolrQueryResponse rsp,ContentStream stream,UpdateRequestProcessor processor) throws IOException {
  errHeader="CSVLoader: input=" + stream.getSourceInfo();
  Reader reader=null;
  try {
    reader=stream.getReader();
    if (skipLines > 0) {
      if (!(reader instanceof BufferedReader)) {
        reader=new BufferedReader(reader);
      }
      BufferedReader r=(BufferedReader)reader;
      for (int i=0; i < skipLines; i++) {
        r.readLine();
      }
    }
    CSVParser parser=new CSVParser(reader,strategy);
    if (fieldnames == null) {
      fieldnames=parser.getLine();
      if (fieldnames == null) {
        throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,"Expected fieldnames in CSV input");
      }
      prepareFields();
    }
    for (; ; ) {
      int line=parser.getLineNumber();
      String[] vals=null;
      try {
        vals=parser.getLine();
      }
 catch (      IOException e) {
        input_err("can't read line: " + line,null,line,e);
      }
      if (vals == null)       break;
      if (vals.length != fieldnames.length) {
        input_err("expected " + fieldnames.length + " values but got "+ vals.length,vals,line);
      }
      addDoc(line,vals);
    }
  }
  finally {
    if (reader != null) {
      IOUtils.closeQuietly(reader);
    }
  }
}

@ Override public void load ( SolrQueryRequest req , SolrQueryResponse rsp , ContentStream stream , UpdateRequestProcessor processor ) throws IOException { errHeader = "CSVLoader: input=" + stream . getSourceInfo ( ) ; Reader reader = null ; try { reader = stream . getReader ( ) ; if ( skipLines > 0 ) { if ( ! ( reader instanceof BufferedReader ) ) { reader = new BufferedReader ( reader ) ; } BufferedReader r = ( BufferedReader ) reader ; for ( int i = 0 ; i < skipLines ; i ++ ) { r . readLine ( ) ; } } CSVParser parser = new CSVParser ( reader , strategy ) ; if ( fieldnames == null ) { fieldnames = parser . getLine ( ) ; if ( fieldnames == null ) { throw new SolrException ( SolrException . ErrorCode . BAD_REQUEST , "Expected fieldnames in CSV input" ) ; } prepareFields ( ) ; } for ( ; ; ) { int line = parser . getLineNumber ( ) ; String [ ] vals = null ; try { vals = parser . getLine ( ) ; } catch ( IOException e ) { input_err ( "can't read line: " + line , null , line , e ) ; } if ( vals == null ) break ; if ( vals . length != fieldnames . length ) { input_err ( "expected " + fieldnames . length + " values but got " + vals . length , vals , line ) ; } addDoc ( line , vals ) ; } } finally { if ( reader != null ) { IOUtils . closeQuietly ( reader ) ; } } }
load the csv input
