diff --git a/junixsocket-demo/src/main/java/org/newsclub/net/unix/demo/okhttp/OkHttpClientDemo.java b/junixsocket-demo/src/main/java/org/newsclub/net/unix/demo/okhttp/OkHttpClientDemo.java index 86712d549..102c17284 100644 --- a/junixsocket-demo/src/main/java/org/newsclub/net/unix/demo/okhttp/OkHttpClientDemo.java +++ b/junixsocket-demo/src/main/java/org/newsclub/net/unix/demo/okhttp/OkHttpClientDemo.java @@ -28,6 +28,8 @@ import org.newsclub.net.unix.demo.DemoHelper; import org.newsclub.net.unix.demo.nanohttpd.NanoHttpdServerDemo; +import com.kohlschutter.util.IOUtil; + import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; @@ -60,7 +62,7 @@ public static void main(String[] args) throws IOException { ResponseBody body = response.body(); if (body != null) { try (InputStream in = body.byteStream()) { // NOPMD.UseTryWithResources - in.transferTo(System.out); + IOUtil.transferAllBytes(in, System.out); } finally { body.close(); } diff --git a/junixsocket-demo/src/main/java/org/newsclub/net/unix/demo/okhttp/OkHttpClientTIPCDemo.java b/junixsocket-demo/src/main/java/org/newsclub/net/unix/demo/okhttp/OkHttpClientTIPCDemo.java index 744ff1beb..5fca3b868 100644 --- a/junixsocket-demo/src/main/java/org/newsclub/net/unix/demo/okhttp/OkHttpClientTIPCDemo.java +++ b/junixsocket-demo/src/main/java/org/newsclub/net/unix/demo/okhttp/OkHttpClientTIPCDemo.java @@ -29,6 +29,8 @@ import org.newsclub.net.unix.demo.DemoHelper; import org.newsclub.net.unix.demo.nanohttpd.NanoHttpdServerDemo; +import com.kohlschutter.util.IOUtil; + import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; @@ -74,7 +76,7 @@ public static void main(String[] args) throws IOException, InterruptedException ResponseBody body = response.body(); if (body != null) { try (InputStream in = body.byteStream()) { // NOPMD.UseTryWithResources - in.transferTo(System.out); + IOUtil.transferAllBytes(in, System.out); } finally { body.close(); }