Android InputStream Copy copyStream(InputStream src, OutputStream dest)

Here you can find the source of copyStream(InputStream src, OutputStream dest)

Description

copy Stream

License

Open Source License

Declaration

public static boolean copyStream(InputStream src, OutputStream dest) 

Method Source Code

//package com.java2s;
import java.io.InputStream;
import java.io.OutputStream;

import java.io.IOException;

public class Main {
    private static int COPYSTREAM_BUFFER_SIZE = 2 * 1024;

    public static boolean copyStream(InputStream src, OutputStream dest) {
        byte[] buffer = new byte[COPYSTREAM_BUFFER_SIZE];

        try {/*w  ww .j a v a 2  s  .  com*/
            int size;

            while ((size = src.read(buffer)) != -1) {
                dest.write(buffer, 0, size);
            }
        } catch (IOException e) {
            return false;
        }

        return true;
    }
}

Related

  1. copyFile(InputStream input, OutputStream output)
  2. copyStream(InputStream in, OutputStream out)
  3. writeStream(InputStream input, OutputStream output)
  4. CopyStream(InputStream is, OutputStream os)
  5. CopyStream(InputStream is, OutputStream os)
  6. copyAllBytes(InputStream in, OutputStream out)
  7. copyRAWFile(InputStream inStream, File newfile)
  8. copyRAWFile(InputStream inStream, FileOutputStream outStream)