Java tutorial
//package com.java2s; //License from project: Apache License import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class Main { /* public static File writeSd(Context mContext, String jsonFile, String fileName) { try { InputStream inputStream1 = mContext.getAssets().open(jsonFile); File file = FileUtils.write2SDFromInput(CacheDisc.getCacheFile(mContext.getApplicationContext()), fileName, inputStream1); return file; } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } return null; }*/ public static void writeExtractedFileToDisk(InputStream in, OutputStream outs) throws IOException { byte[] buffer = new byte[1024]; int length; while ((length = in.read(buffer)) > 0) { outs.write(buffer, 0, length); } outs.flush(); outs.close(); in.close(); } }