Package com.csvreader

Examples of com.csvreader.CsvReader.readHeaders()


        builder.setName(entry.getName());

        // read headers
        CsvReader reader = getDataStore().read();
        try {
            boolean success = reader.readHeaders();
            if (success == false) {
                throw new IOException("Header of CSV file not available");
            }

            // we are going to hard code a point location
View Full Code Here


    // count start
    protected int getCountInternal(Query query) throws IOException {
        if (query.getFilter() == Filter.INCLUDE) {
            CsvReader reader = getDataStore().read();
            try {
                boolean connect = reader.readHeaders();
                if (connect == false) {
                    throw new IOException("Unable to connect");
                }
                int count = 0;
                while (reader.readRecord()) {
View Full Code Here

        builder.setName(entry.getName());

        // read headers
        CsvReader reader = getDataStore().read();
        try {
            boolean success = reader.readHeaders();
            if (success == false) {
                throw new IOException("Header of CSV file not available");
            }

            // we are going to hard code a point location
View Full Code Here

            String id = null;
            Node node;
            Attributes nodeAttributes;
            reader = new CsvReader(new FileInputStream(file), separator, charset);
            reader.setTrimWhitespace(false);
            reader.readHeaders();
            while (reader.readRecord()) {
                //Prepare the correct node to assign the attributes:
                if (idColumn != null) {
                    id = reader.get(idColumn);
                    if (id == null || id.isEmpty()) {
View Full Code Here

            try {
                CsvReader reader = new CsvReader(new FileInputStream(selectedFile), getSelectedSeparator(), getSelectedCharset());
                reader.setTrimWhitespace(false);
                String[] headers;
                try {
                    reader.readHeaders();
                    headers = reader.getHeaders();
                } catch (Exception ex) {
                    headers = new String[0];//Some charsets can be problematic with unreal columns lenght. Don't show table when there are problems
                }
                columnCount = headers.length;
View Full Code Here

            JLabel columnsLabel = new JLabel(getMessage("ImportCSVUIVisualPanel2.columnsLabel.text"));
            settingsPanel.add(columnsLabel, "wrap");

            CsvReader reader = new CsvReader(new FileInputStream(file), separator, charset);
            reader.setTrimWhitespace(false);
            reader.readHeaders();
            final String[] columns = reader.getHeaders();
            reader.close();

            boolean sourceFound = false, targetFound = false, typeFound = false;//Only first source and target columns found will be used as source and target nodes ids.
            for (int i = 0; i < columns.length; i++) {
View Full Code Here

            reader = new BufferedReader(new FileReader(file));
        } else {
            reader = new StringReader(dataInput);
        }
        CsvReader csvReader = new CsvReader(reader);
        if (!csvReader.readHeaders()) {
            throw new IOException("Error reading csv headers");
        }
        return csvReader;
    }
View Full Code Here

   
    @Test
    public void testCsv() throws Exception {
       
        CsvReader reader = CsvKit.self().makeReader("src/test/resources/pricing_source.csv");
        reader.readHeaders();
        while(reader.readRecord()) {
           
            String source = reader.get(0);
            Assert.assertNotNull(source);
            String description = reader.get(1);
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.