Package com.Ostermiller.util

Examples of com.Ostermiller.util.CSVParser


    private XMLEventReader r;

    Digester(Reader reader, String extension) throws HttpException {
      if (extension.equals("csv")) {
        shredder = new CSVParser(reader);
        shredder.setCommentStart("#");
        shredder.setEscapes("nrtf", "\n\r\t\f");

      } else if (extension.equals("xml")) {
        XMLInputFactory factory = XMLInputFactory.newInstance();
View Full Code Here


    }
    try {
      if (isExcel) {
        shredder = new ExcelCSVParser(new StraightStreamReader(in));
      } else {
        CSVParser standardParser = new CSVParser(new StraightStreamReader(in));
        standardParser.setCommentStart("#!");
        standardParser.setEscapes("nrtf", "\n\r\t\f");
        shredder = standardParser;
      }
      shredder.changeDelimiter(delimiter);
    } catch (Exception e) {
      return null;
View Full Code Here

public class OstermillerParser implements Parser {
  private com.Ostermiller.util.CSVParser parser;
 
  public OstermillerParser(InputStream is , char separator) {
    parser = new CSVParser(is, separator);
  }
View Full Code Here

      return importEntity( ';');
    }
    public Object[] importEntity(char separator) {
        List ents = new ArrayList();
        try {
            CSVParser parser = new CSVParser(new FileInputStream(_csvfile), separator);
            String[] line = parser.getLine();
            Object ent;
            while (line != null) {
                ent = _cst.getObjectFromLine(line);
                if (ent != null) {
                    ents.add(ent);
                } else {
                    System.out.println("The csv file " + _csvfile.getAbsolutePath() + " does not contain proper data for " + _cst.getClass().getName());
                }
                line = parser.getLine();
            }
        } catch (BadDelimiterException e) {
            e.printStackTrace();
        } catch (FileNotFoundException e) {
            System.out.println("The csv file " + _csvfile.getAbsolutePath() + " does not exist.");
View Full Code Here

TOP

Related Classes of com.Ostermiller.util.CSVParser

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.