Is this the best way to download a file in java?

后端 未结 4 1824
半阙折子戏
半阙折子戏 2021-01-07 07:20
public void download(String url, String destination) {
        BufferedOutputStream localBufferedOutputStream = null;
        URLConnection localURLConnection = null         


        
4条回答
  •  囚心锁ツ
    2021-01-07 07:36

    You can leave out the BufferedOutputStream since you're already using a buffer yourself. But that's not going to make a big difference.

    What may (or may not) make a big difference is using the nio channel classes instead of the streams.

提交回复
热议问题