久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      java如何實現(xiàn)保存文件到本地

      java如何實現(xiàn)保存文件到本地

      具體實現(xiàn)過程請看如下實例:(推薦學習:java視頻教程)

      private void savePic(InputStream inputStream, String fileName) {       OutputStream os = null;     try {       String path = "D:\testFile\";       // 2、保存到臨時文件       // 1K的數(shù)據(jù)緩沖       byte[] bs = new byte[1024];       // 讀取到的數(shù)據(jù)長度       int len;       // 輸出的文件流保存到本地文件         File tempFile = new File(path);       if (!tempFile.exists()) {         tempFile.mkdirs();       }       os = new FileOutputStream(tempFile.getPath() + File.separator + fileName);       // 開始讀取       while ((len = inputStream.read(bs)) != -1) {         os.write(bs, 0, len);       }       } catch (IOException e) {       e.printStackTrace();     } catch (Exception e) {       e.printStackTrace();     } finally {       // 完畢,關(guān)閉所有鏈接       try {         os.close();         inputStream.close();       } catch (IOException e) {         e.printStackTrace();       }     }   }

      推薦教程:java入門教程

      贊(0)
      分享到: 更多 (0)
      ?
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號