Android InputStream Save saveStream(InputStream is, String savePath)

Here you can find the source of saveStream(InputStream is, String savePath)

Description

save Stream

Declaration

private static void saveStream(InputStream is, String savePath)
            throws IOException 

Method Source Code

//package com.java2s;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;

public class Main {
    private static int BUFF_SIZE = 1024;

    private static void saveStream(InputStream is, String savePath)
            throws IOException {
        FileOutputStream output = new FileOutputStream(savePath);
        int readlen;

        byte[] buf = new byte[BUFF_SIZE];
        while ((readlen = is.read(buf)) > 0)
            output.write(buf, 0, readlen);
        output.close();/* www  .ja v a 2 s. com*/
        is.close();
    }
}

Related

  1. writeFile(File outputFile, InputStream inputStream)
  2. saveFile(Context context, String fileName, InputStream inputStream)
  3. writeXmlToTempFile(InputStream xmlStream, String filePath, String closingTag)
  4. writeToString(InputStream stream)
  5. saveInputStreamAsFile(InputStream inputStream, File target)
  6. saveTmpFile(InputStream is)
  7. toBase64OutputStream(InputStream is, OutputStream os)
  8. toOutputStream(InputStream is, OutputStream os)
  9. doOutputFile(InputStream is, String filename)