Java InputStream to OutputStream inputStreamToOutputStream(final InputStream inputStream, final OutputStream outputStream)

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

Description

input Stream To Output Stream

License

Open Source License

Declaration

public static void inputStreamToOutputStream(final InputStream inputStream, final OutputStream outputStream) 

Method Source Code

//package com.java2s;

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

public class Main {
    public static void inputStreamToOutputStream(final InputStream inputStream, final OutputStream outputStream) {
        try {// w w  w .ja va 2  s .  co m
            final byte[] buf = new byte[1024];
            int length;
            while ((length = inputStream.read(buf)) > 0) {
                outputStream.write(buf, 0, length);
            }
        } catch (final Exception e) {
            throw new RuntimeException(e);
        }
    }
}

Related

  1. copyStreamToFileBinary(final InputStream stream, final File output)
  2. copyStreamToStream(final InputStream input, final OutputStream output)
  3. copyStreamToStream(InputStream in, OutputStream out)
  4. inputStreamToOutputStream(final InputStream in, final OutputStream out)
  5. inputStreamToOutputStream(final InputStream in, final OutputStream out, int buffer)
  6. inputStreamToOutputStream(InputStream inStream, OutputStream outStream)
  7. inputStreamToOutputStream(InputStream is, OutputStream os)