@@ -0,0 +1,2507 @@
+package weatherhandler.parser;%0A%0Aimport java.io.FileNotFoundException;%0Aimport java.io.IOException;%0Aimport java.io.Reader;%0Aimport java.io.BufferedReader;%0Aimport java.io.FileReader;%0Aimport java.lang.AutoCloseable;%0Aimport java.util.List;%0Aimport java.util.ArrayList;%0Aimport java.util.stream.Stream;%0A%0Aimport weatherhandler.data.Measurement;%0Aimport weatherhandler.Logger;%0Aimport weatherhandler.processor.Processor;%0Aimport weatherhandler.processor.ProcessorException;%0A%0Apublic class TSVParser implements AutoCloseable %7B%0A    private Logger logger = new Logger(%22TSVParser%22);%0A    private BufferedReader reader;%0A    private Stream%3CString%3E stream;%0A    private Processor output;%0A%0A    public TSVParser(String fileName, Processor out) throws FileNotFoundException %7B%0A        this(new FileReader(fileName), out);%0A    %7D%0A    public TSVParser(Reader reader, Processor out) %7B%0A        this.reader = new BufferedReader(reader);%0A        this.stream = this.reader.lines();%0A        this.output = out;%0A    %7D%0A%0A    public void process() %7B%0A        this.stream%0A            .map(this::parse)%0A            .map(this::toList)%0A            .forEach(this::processMeasurements);%0A    %7D%0A%0A    public void close() throws IOException %7B%0A        this.reader.close();%0A    %7D%0A%0A    private List%3CMeasurement%3E toList(Measurement m) %7B%0A        List%3CMeasurement%3E list = new ArrayList%3C%3E(1);%0A        list.add(m);%0A        return list;%0A    %7D%0A%0A    private void processMeasurements(List%3CMeasurement%3E measurements) %7B%0A        try %7B%0A            this.output.processMeasurements(measurements);%0A        %7D catch (ProcessorException e) %7B%0A            this.logger.error(%22Processor error:%22);%0A            e.printStackTrace();%0A        %7D%0A    %7D%0A%0A    private Measurement parse(String line) %7B%0A        Measurement m = new Measurement();%0A%0A        String%5B%5D data = line.split(%22%5Ct%22);%0A        m.setStation(Integer.parseInt(data%5B0%5D, 10));%0A        m.setDate(data%5B1%5D);%0A        m.setTime(data%5B2%5D);%0A        m.setTemperature(Float.parseFloat(data%5B3%5D));%0A        m.setDewPoint(Float.parseFloat(data%5B4%5D));%0A        m.setStationPressure(Float.parseFloat(data%5B5%5D));%0A        m.setSeaLevelPressure(Float.parseFloat(data%5B6%5D));%0A        m.setVisibility(Float.parseFloat(data%5B7%5D));%0A        m.setWindSpeed(Float.parseFloat(data%5B8%5D));%0A        m.setPrecipitation(Float.parseFloat(data%5B9%5D));%0A        m.setSnowDepth(Float.parseFloat(data%5B10%5D));%0A        m.setEvents(data%5B11%5D);%0A        m.setCloudCover(Float.parseFloat(data%5B12%5D));%0A        m.setWindDirection(Integer.parseInt(data%5B13%5D, 10));%0A%0A        return m;%0A    %7D%0A%7D%0A

Add TSVParser for _reading_ TSV files