Package org.apache.commons.csv

Examples of org.apache.commons.csv.CSVParser


{
    private CSVParser parser;

    public Reader( InputStream stream )
    {
        parser = new CSVParser( new InputStreamReader( stream ) );
    }
View Full Code Here


    }

    public Object unmarshal(Exchange exchange, InputStream inputStream) throws Exception {
        InputStreamReader in = new InputStreamReader(inputStream);
        try {
            CSVParser parser = new CSVParser(in, getStrategy());
            List<List<String>> list = new ArrayList<List<String>>();
            while (true) {
                String[] strings = parser.getLine();
                if (strings == null) {
                    break;
                }
                List<String> line = Arrays.asList(strings);
                list.add(line);
View Full Code Here

    }

    public Object unmarshal(Exchange exchange, InputStream inputStream) throws Exception {
        InputStreamReader in = new InputStreamReader(inputStream);
        try {
            CSVParser parser = new CSVParser(in, getStrategy());
            List<List<String>> list = new ArrayList<List<String>>();
            while (true) {
                String[] strings = parser.getLine();
                if (strings == null) {
                    break;
                }
                List<String> line = Arrays.asList(strings);
                list.add(line);
View Full Code Here

        strategy.setDelimiter(config.getDelimiter());

        InputStreamReader in = new InputStreamReader(inputStream, IOHelper.getCharsetName(exchange));

        try {
            CSVParser parser = new CSVParser(in, strategy);
            List<List<String>> list = new ArrayList<List<String>>();
            boolean isFirstLine = true;
            while (true) {
                String[] strings = parser.getLine();
                if (isFirstLine) {
                    isFirstLine = false;
                    if (skipFirstLine) {
                        // skip considering the first line if we're asked to do so
                        continue;
View Full Code Here

        .getEncapsulator().length() == 0) ? CSVStrategy.ENCAPSULATOR_DISABLED
        : CharUtils.toChar(loader.getEncapsulator());
    log.info(String.format("delimiter %d encapsulator %d", (int)delimiter, (int)encapsulator));
    CSVStrategy strategy = new CSVStrategy(delimiter, encapsulator, CSVStrategy.COMMENTS_DISABLED,
        CSVStrategy.ESCAPE_DISABLED, true, true, false, true);
    parser = new CSVParser(reader, strategy);
    this.loader = loader;
    formatMap = new HashMap<String, Format>();
    try {
      for (Column col : loader.getColumn()) {
        if (col.getFormat() != null && col.getFormat().length() > 0) {
View Full Code Here

        if (delimiter != null) {
            strategy.setDelimiter(delimiter.charAt(0));
        }
       
        try {
            CSVParser parser = new CSVParser(in, strategy);
            List<List<String>> list = new ArrayList<List<String>>();
            while (true) {
                String[] strings = parser.getLine();
                if (strings == null) {
                    break;
                }
                List<String> line = Arrays.asList(strings);
                list.add(line);
View Full Code Here

public class CSVVectorIterator extends AbstractIterator<Vector> {

  private final CSVParser parser;

  public CSVVectorIterator(Reader reader) {
    parser = new CSVParser(reader);
  }
View Full Code Here

  public CSVVectorIterator(Reader reader) {
    parser = new CSVParser(reader);
  }

  public CSVVectorIterator(Reader reader, CSVStrategy strategy) {
    parser = new CSVParser(reader, strategy);
  }
View Full Code Here

        if (delimiter != null) {
            strategy.setDelimiter(delimiter.charAt(0));
        }
       
        try {
            CSVParser parser = new CSVParser(in, strategy);
            List<List<String>> list = new ArrayList<List<String>>();
            while (true) {
                String[] strings = parser.getLine();
                if (strings == null) {
                    break;
                }
                List<String> line = Arrays.asList(strings);
                list.add(line);
View Full Code Here

        if (delimiter != null) {
            strategy.setDelimiter(delimiter.charAt(0));
        }
       
        try {
            CSVParser parser = new CSVParser(in, strategy);
            List<List<String>> list = new ArrayList<List<String>>();
            boolean isFirstLine = true;
            while (true) {
                String[] strings = parser.getLine();
                if (isFirstLine) {
                    isFirstLine = false;
                    if (skipFirstLine) {
                        // skip considering the first line if we're asked to do so
                        continue;
View Full Code Here

TOP

Related Classes of org.apache.commons.csv.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.