Examples of CSVReader


Examples of com.fasterxml.jackson.dataformat.csv.impl.CsvReader

        super(parserFeatures);   
        _objectCodec = codec;
        _textBuffer = new TextBuffer(br);
        _csvFeatures = csvFeatures;
        _parsingContext = JsonReadContext.createRootContext();
        _reader = new CsvReader(this, ctxt, reader, _schema, _textBuffer,
                isEnabled(JsonParser.Feature.AUTO_CLOSE_SOURCE),
                isEnabled(Feature.TRIM_SPACES));
    }
View Full Code Here

Examples of com.sardak.antform.util.CSVReader

  /**
   * set selected value
   */
  public void setValue(String value) {
    CSVReader reader = new CSVReader(separator, escapeSequence);
    List valueList = value == null ? new ArrayList() : reader.digest(value, true);
    for (Iterator iterator = buttons.iterator(); iterator.hasNext();) {
      JCheckBox checkBox = (JCheckBox) iterator.next();
      checkBox.setSelected(valueList.contains(checkBox.getText()));
    }
  }
View Full Code Here

Examples of com.sforce.async.CSVReader

  public void checkResults(BulkConnection connection, JobInfo job,
      List<BatchInfo> batchInfoList) throws AsyncApiException,
      IOException {
    // batchInfoList was populated when batches were created and submitted
    for (BatchInfo b : batchInfoList) {
      CSVReader rdr = new CSVReader(connection.getBatchResultStream(
          job.getId(), b.getId()));
      List<String> resultHeader = rdr.nextRecord();
      int resultCols = resultHeader.size();
      List<String> row;
      while ((row = rdr.nextRecord()) != null) {
        Map<String, String> resultInfo = new HashMap<String, String>();
        for (int i = 0; i < resultCols; i++) {
          resultInfo.put(resultHeader.get(i), row.get(i));
        }
        boolean success = Boolean.valueOf(resultInfo.get("Success"));
View Full Code Here

Examples of com.sforce.async.CSVReader

    private void initalizeInput() throws DataAccessObjectInitializationException {
        try {
            input = new FileInputStream(file);
            if (forceUTF8 || isUTF8File(file)) {
                csvReader = new CSVReader(input, "UTF-8");
            } else {
                csvReader = new CSVReader(input);
            }
            csvReader.setMaxRowsInFile(Integer.MAX_VALUE);
            csvReader.setMaxCharsInFile(Integer.MAX_VALUE);
        } catch (FileNotFoundException e) {
            String errMsg = Messages.getFormattedString("CSVFileDAO.errorOpen", file.getAbsolutePath());
View Full Code Here

Examples of com.sforce.async.CSVReader

    }

    private void validateExtraction(final String name, final Map<String, String> testConfig) throws IOException {
        FileInputStream fis = new FileInputStream(new File(testConfig.get(Config.DAO_NAME)));
        try {
            CSVReader rdr = new CSVReader(fis, "UTF-8");
            int nameidx = rdr.nextRecord().indexOf("NAME");
            assertEquals(name, rdr.nextRecord().get(nameidx));
        } finally {
            IOUtils.closeQuietly(fis);
        }
    }
View Full Code Here

Examples of com.sforce.async.CSVReader

    }

    private void validateAccountNameInOutputFile(final String accountName) throws IOException {
        FileInputStream fis = new FileInputStream(new File(testConfig.get(Config.DAO_NAME)));
        try {
            CSVReader rdr = new CSVReader(fis, "UTF-8");
            int acctNameIndex = rdr.nextRecord().indexOf("ACCOUNT.NAME");
            assertEquals(accountName, rdr.nextRecord().get(acctNameIndex));
        } finally {
            IOUtils.closeQuietly(fis);
        }
    }
View Full Code Here

Examples of com.sforce.async.CSVReader

            if (getProgressMonitor().isCanceled()) return;
            try {
                final InputStream resultStream = getController().getBulkClient().getClient()
                        .getQueryResultStream(this.batch.getJobId(), this.batch.getId(), resultId);
                try {
                    final CSVReader rdr = new CSVReader(resultStream, Config.BULK_API_ENCODING);
                    rdr.setMaxCharsInFile(Integer.MAX_VALUE);
                    rdr.setMaxRowsInFile(Integer.MAX_VALUE);
                    List<String> headers;
                    headers = rdr.nextRecord();
                    List<String> csvRow;
                    while ((csvRow = rdr.nextRecord()) != null) {
                        final StringBuilder id = new StringBuilder();
                        final Row daoRow = getDaoRow(headers, csvRow, id);
                        addResultRow(daoRow, id.toString());
                    }
                } finally {
View Full Code Here

Examples of com.sforce.async.CSVReader

    BatchInfoList getBatches() throws AsyncApiException {
        return this.client.getBatchInfoList(getJobId());
    }

    CSVReader getBatchResults(String batchId) throws AsyncApiException {
        return new CSVReader(this.client.getBatchResultStream(getJobId(), batchId));
    }
View Full Code Here

Examples of com.sforce.async.CSVReader

    private void processBatchResults(final BatchInfo batch, final String errorMessage, final BatchStateEnum state,
            final List<Row> rows) throws DataAccessObjectException, IOException, AsyncApiException {

        // get the batch csv result stream from sfdc
        final CSVReader resultRdr = this.jobUtil.getBatchResults(batch.getId());

        // read in the result csv header and note the column indices
        Map<String, Integer> hdrIndices = mapHeaderIndices(resultRdr.nextRecord());
        final int successIdx = hdrIndices.get(SUCCESS_RESULT_COL);
        final int createdIdx = isDelete ? -1 : hdrIndices.get(CREATED_RESULT_COL);
        final int idIdx = hdrIndices.get(ID_RESULT_COL);
        final int errIdx = hdrIndices.get(ERROR_RESULT_COL);
        hdrIndices = null;

        for (final Row row : rows) {
            final List<String> res = resultRdr.nextRecord();

            // no result for this column. In this case it failed, and we should use the batch state message
            if (state == BatchStateEnum.Failed || errorMessage != null) {
                getLogger().warn(
                        Messages.getMessage(getClass(), "logBatchInfoWithMessage", batch.getId(), state, errorMessage));
View Full Code Here

Examples of eu.stratosphere.api.java.io.CsvReader

   *
   * @param filePath The path of the CSV file.
   * @return A CsvReader that can be used to configure the CSV input.
   */
  public CsvReader readCsvFile(String filePath) {
    return new CsvReader(filePath, this);
  }
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.