Package au.com.bytecode.opencsv

Examples of au.com.bytecode.opencsv.CSVReader.readNext()


     
      while (line != null) {
        if (line.length > 1) {
          systemMessages.put(Integer.valueOf(line[0]), line[1]);
        }
        line = reader.readNext();
      }
    } catch (Exception e) {
      logger.log(Level.SEVERE, "Failed to load /db/systemmessages.csv", e);
   
  }
View Full Code Here


    npcCache = new HashMap<Integer, CSVDatastoreDAO.CSVNpc>();
    try {
      CSVReader reader = new CSVReader(new InputStreamReader(
          CSVDatastoreDAO.class.getResourceAsStream("/db/npc.csv")), 1/*skip header*/, new CSVParser('\t','"','\\'));
     
      String[] line = reader.readNext();
      while (line != null) {
        if (line.length > 2) {
          CSVNpc n = new CSVNpc();
          n.id = Integer.valueOf(line[0]);
          n.idTemplate = Integer.valueOf(line[1]);
View Full Code Here

          if (line.length > 3)
            n.gamemodel = line[3];

          npcCache.put(n.idTemplate, n);
        }
        line = reader.readNext();
      }
    } catch (Exception e) {
      logger.log(Level.SEVERE, "Failed to load /db/npc.csv", e);
    }   
  }
View Full Code Here

    itemCache = new HashMap<Integer, CSVDatastoreDAO.CSVItem>();
    try {
      CSVReader reader = new CSVReader(new InputStreamReader(
          CSVDatastoreDAO.class.getResourceAsStream("/db/items.csv")), 1/*skip header*/, new CSVParser('\t','"','\\'));
     
      String[] line = reader.readNext();
      while (line != null) {
        if (line.length > 2) {
          CSVItem n = new CSVItem();
          n.id = Integer.valueOf(line[0]);
          n.type = line[1];
View Full Code Here

          n.type = line[1];
          n.descriptionShort = line[2];

          itemCache.put(n.id, n);
        }
        line = reader.readNext();
      }
    } catch (Exception e) {
      logger.log(Level.SEVERE, "Failed to load /db/items.csv", e);
    }   
  }
View Full Code Here

  public static List<ComputerBean> queryComputerBean() throws IOException {
    File csv = new File(Executions.getCurrent().getDesktop().getWebApp().getRealPath("/WEB-INF/xls/demo/data.csv"));
    CSVReader reader = new CSVReader(new FileReader(csv));
    List<ComputerBean> data = new ArrayList<ComputerBean>();
    String[] nextLine;
      while ((nextLine = reader.readNext()) != null) {
        ComputerBean computerBean = new ComputerBean();
        computerBean.setId(nextLine[0]);
        computerBean.setProduct(nextLine[1]);
        computerBean.setBrand(nextLine[2]);
        computerBean.setModel(nextLine[3]);
View Full Code Here

    try
    {
      FileInputStream fis = new FileInputStream(emailsFile);
      InputStreamReader isr = new InputStreamReader(fis, charset);
      reader=new CSVReader(isr, ',','"',false);
      headers = reader.readNext();
      personParameters.addAll(reader.readAll());
      reader.close();
    }catch (FileNotFoundException fnfe)
    {
      System.err.println("File with emails not exists: " + file);
View Full Code Here

        ArrayList<HistoricalPrice> result = new ArrayList<HistoricalPrice>();
        String[] nextLine;

        try {
            while ((nextLine = reader.readNext()) != null) {
                HistoricalPrice hp = new HistoricalPrice();
                hp.setTime(DateTime.parse(nextLine[0]));
                hp.setSpotPrice(Money.of(CurrencyUnit.USD, new BigDecimal(nextLine[1])));
                result.add(hp);
            }
View Full Code Here

    }
 
    Date youngest_order_date_found = null;
    CSVReader csvparser = new CSVReader(getFileAsInputStream(PLAYTRADE_FILE_ENCODING,getDiscardBOM()), FLAT_FILE_DELIMITER, '~')//need to use a quote char that isnt in the file because csvreader seems to use " be default if one isnt specified, (if file has no delimiter)
   
    String[] headerline = csvparser.readNext();

    String[] line = null//the current line being read from the csv file      
    while( (line = csvparser.readNext()) != null )
    {         
      if ( line.length != headerline.length )
View Full Code Here

    CSVReader csvparser = new CSVReader(getFileAsInputStream(PLAYTRADE_FILE_ENCODING,getDiscardBOM()), FLAT_FILE_DELIMITER, '~')//need to use a quote char that isnt in the file because csvreader seems to use " be default if one isnt specified, (if file has no delimiter)
   
    String[] headerline = csvparser.readNext();

    String[] line = null//the current line being read from the csv file      
    while( (line = csvparser.readNext()) != null )
    {         
      if ( line.length != headerline.length )
      {
        csvparser.close();
        throw new Error("The row doesn't have the same number of columns as the header " + line.length + "!=" + headerline.length);
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.