Java InputStream to OutputStream copyStreamContent(InputStream inputStream, OutputStream outputStream)

Here you can find the source of copyStreamContent(InputStream inputStream, OutputStream outputStream)

Description

copy Stream Content

License

Open Source License

Declaration

public static int copyStreamContent(InputStream inputStream, OutputStream outputStream) throws IOException 

Method Source Code


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

import java.io.*;

public class Main {
    public static int copyStreamContent(InputStream inputStream, OutputStream outputStream) throws IOException {
        byte[] buffer = new byte[10240];

        int total = 0;
        int count;
        while ((count = inputStream.read(buffer)) > 0) {
            outputStream.write(buffer, 0, count);
            total += count;/*from   w  w  w  .  ja  v  a 2  s.co m*/
        }
        return total;
    }
}

Related

  1. copyStream(OutputStream outStream, InputStream inStream)
  2. copyStream(Reader input, Writer output)
  3. copyStreamAndClose(InputStream is, OutputStream os)
  4. copyStreamAndClose(InputStream is, OutputStream os)
  5. copyStreamBounded(InputStream in, OutputStream out, long length)
  6. copyStreamContent(InputStream inputStream, OutputStream outputStream)
  7. copyStreamFully(InputStream in, OutputStream out, int length)
  8. copyStreamIoe(final InputStream is, final OutputStream os)
  9. copyStreamNoClose(InputStream in, OutputStream out)