1 package org.simantics.gnuplot;
3 import java.io.IOException;
4 import java.io.InputStream;
5 import java.nio.file.Files;
6 import java.nio.file.Path;
7 import java.nio.file.StandardCopyOption;
10 * @author Tuukka Lehtonen
13 class InputStreamToFileCopier implements Runnable {
15 private final InputStream in;
16 private final Path out;
18 public InputStreamToFileCopier(InputStream in, Path out) {
27 Files.copy(in, out, StandardCopyOption.REPLACE_EXISTING);
31 } catch (IOException e) {
36 private static void drain(InputStream in) throws IOException {
37 while (in.read() >= 0);