Java Utililty Methods InputStream to OutputStream

List of utility methods to do InputStream to OutputStream

Description

The list of methods to do InputStream to OutputStream are organized into topic(s).

Method

voidinputStreamToOutputStream(final InputStream in, final OutputStream out)
Copy an input stream completely to an output stream.
byte[] buffer = null;
boolean streaming = true;
while (streaming) {
    buffer = new byte[CHUNK_SIZE];
    final int count = in.read(buffer);
    if (count == -1) {
        streaming = false;
    } else {
...
longinputStreamToOutputStream(final InputStream in, final OutputStream out, int buffer)
Copies the content of an InputStream to an OutputStream.
if (buffer < 1)
    buffer = DEFAULT_BUFFER;
final byte[] byteBuffer = new byte[buffer];
long count = 0;
int n = 0;
while ((n = in.read(byteBuffer)) != -1) {
    out.write(byteBuffer, 0, n);
    count += n;
...
voidinputStreamToOutputStream(final InputStream inputStream, final OutputStream outputStream)
input Stream To Output Stream
try {
    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);
...
voidinputStreamToOutputStream(InputStream inStream, OutputStream outStream)
input Stream To Output Stream
PrintWriter printWritter = new PrintWriter(new OutputStreamWriter(outStream));
BufferedReader bufReader = new BufferedReader(new InputStreamReader(inStream));
String line;
while ((line = bufReader.readLine()) != null) {
    printWritter.println(line);
printWritter.flush();
voidinputStreamToOutputStream(InputStream is, OutputStream os)
copy of an inputstream to corresponding outputStream be carefull on using this method
byte[] buf = new byte[8192];
int len = is.read(buf);
while (len >= 0) {
    os.write(buf, 0, len);
    os.flush();
    len = is.read(buf);
is.close();
...