Newer
Older
osmCoverage / src / osm / jp / postgis / PipeConverter.java
@yuu yuu on 29 Dec 2018 756 bytes UnMapped: Piped create KMZ file.
package osm.jp.postgis;

import java.io.IOException;
import java.io.ByteArrayOutputStream;
import java.io.PipedReader;

public class PipeConverter implements Runnable {
    PipedReader source;
    ByteArrayOutputStream out;
    
    public PipeConverter(PipedReader source, ByteArrayOutputStream out) {
        this.source = source;
        this.out = out;
    }

    @Override
    @SuppressWarnings("CallToPrintStackTrace")
    public void run() {
        try {
            int data = source.read();
            while (data != -1) {
                out.write(data);
                data = source.read();
            }
            out.flush();
            out.close();
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }
}