This question already has answers here:
Easy way to write contents of a Java InputStream to an OutputStream
(23个答案)
去年关闭。
我已经阅读了Android的Security with HTTPS and SSL文档。我看到它一直在使用
这是有问题的代码:
(23个答案)
去年关闭。
我已经阅读了Android的Security with HTTPS and SSL文档。我看到它一直在使用
copyInputStreamToOutputStream(in, System.out);
。那给我error: cannot find symbol method copyInputStreamToOutputStream(InputStream,PrintStream)
这是有问题的代码:
URL url = new URL("https://wikipedia.org");
URLConnection urlConnection = url.openConnection();
InputStream in = urlConnection.getInputStream();
copyInputStreamToOutputStream(in, System.out);
copyInputStreamToOutputStream
是什么意思? 最佳答案
Easy way to write contents of a Java InputStream to an OutputStream
来自Apache的org.apache.commons.io.IOUtils具有一种称为
copy(InputStream,OutputStream)确实可以满足您的需求
对于。
IOUtils.copy(in,out);
关于java - copyInputStreamToOutputStream(in,System.out),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/39886808/
10-11 01:15