Java OutputStream Write copyBytes(InputStream is, OutputStream bytes)

Here you can find the source of copyBytes(InputStream is, OutputStream bytes)

Description

copy Bytes

License

Open Source License

Declaration

private static void copyBytes(InputStream is, OutputStream bytes) throws IOException 

Method Source Code

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

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

public class Main {
    private static void copyBytes(InputStream is, OutputStream bytes) throws IOException {
        int res = is.read();
        while (res != -1) {
            bytes.write(res);//w w  w. j a va2 s. c  o  m
            res = is.read();
        }
    }
}

Related

  1. copyBytes(InputStream in, OutputStream out, int buffSize, boolean close)
  2. copyBytes(InputStream input, int size, OutputStream output)
  3. copyBytes(InputStream inputStream, OutputStream outputStream, int size)
  4. copyBytes(InputStream is, DataOutputStream[] os, long numBytes)
  5. copyBytes(InputStream iStream, OutputStream oStream)
  6. copyBytesAndClose(final InputStream is, final OutputStream os)
  7. copyBytesToFile(byte[] bytes, File outputFile)
  8. copyBytesToStream(ByteArrayOutputStream from, OutputStream to)