Android InputStream Copy copyAllBytes(InputStream in, OutputStream out)

Here you can find the source of copyAllBytes(InputStream in, OutputStream out)

Description

copy All Bytes

License

Open Source License

Declaration

public static int copyAllBytes(InputStream in, OutputStream out)
            throws IOException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.InputStream;
import java.io.OutputStream;
import java.io.IOException;

public class Main {
    public static int copyAllBytes(InputStream in, OutputStream out)
            throws IOException {
        int byteCount = 0;
        byte[] buffer = new byte[4096];
        while (true) {
            int read = in.read(buffer);
            if (read == -1) {
                break;
            }//from   ww w. ja v a  2s.  c o m
            out.write(buffer, 0, read);
            byteCount += read;
        }
        return byteCount;
    }
}

Related

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