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(); } } }