All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.simpleflatmapper.lightningcsv.CloseableCsvReader Maven / Gradle / Ivy

Go to download

Java library to map flat record - ResultSet, csv - to java object with minimum configuration and low footprint.

There is a newer version: 9.0.2
Show newest version
package org.simpleflatmapper.lightningcsv;

import org.simpleflatmapper.lightningcsv.parser.CellConsumer;
import org.simpleflatmapper.util.CheckedConsumer;

import java.io.Closeable;
import java.io.IOException;
import java.util.Iterator;
//IFJAVA8_START
import java.util.stream.Stream;
//IFJAVA8_END

public class CloseableCsvReader implements Closeable, Iterable {

    private final CsvReader delegate;
    private final Closeable resource;

    public CloseableCsvReader(CsvReader delegate, Closeable resource) {
        this.delegate = delegate;
        this.resource = resource;
    }

    public  CC parseAll(CC cellConsumer) throws IOException {
        return delegate.parseAll(cellConsumer);
    }

    public boolean parseRow(CellConsumer cellConsumer) throws IOException {
        return delegate.parseRow(cellConsumer);
    }

    public void skipRows(int n) throws IOException {
        delegate.skipRows(n);
    }

    public  CC parseRows(CC cellConsumer, int limit) throws IOException {
        return delegate.parseRows(cellConsumer, limit);
    }

    public > RH read(RH handler) throws IOException {
        return delegate.read(handler);
    }

    public > RH read(RH handler, int limit) throws IOException {
        return delegate.read(handler, limit);
    }

    @Override
    public Iterator iterator() {
        return delegate.iterator();
    }


    //IFJAVA8_START
    public Stream stream() {
        return delegate.stream();
    }
    //IFJAVA8_END

    @Override
    public void close() throws IOException {
        resource.close();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy