Source Code : Read from InputStream and write to OutputStream
Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com.
Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com.
Click Here or search from google with Libraries Name you get jar file related it
Read from InputStream and write to OutputStream
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
public class Main {
/**
* Read input from input stream and write it to output stream
* until there is no more input from input stream.
*
* @param is input stream the input stream to read from.
* @param os output stream the output stream to write to.
* @param buf the byte array to use as a buffer
*/
public static void flow( InputStream is, OutputStream os, byte[] buf )
throws IOException {
int numRead;
while ( (numRead = is.read(buf) ) >= 0) {
os.write(buf, 0, numRead);
}
}
}
Thank with us