Android InputStream Copy copy(InputStream inputStream, OutputStream outputStream)

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

Description

Copies from the InputStream into the OutputStream .

License

Open Source License

Parameter

Parameter Description
inputStream the GZIPInputStream .
outputStream the OutputStream .

Exception

Parameter Description
IOException error handling files.

Declaration

public static void copy(InputStream inputStream,
        OutputStream outputStream) throws IOException 

Method Source Code

//package com.java2s;
// Licensed under the Apache License, Version 2.0 (the "License");

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

public class Main {
    /**// w ww  .j  ava 2 s . c om
     * Copies from the {@code InputStream} into the {@code OutputStream}.
     *
     * @param inputStream the {@code GZIPInputStream}.
     * @param outputStream the {@code OutputStream}.
     * @throws IOException error handling files.
     */
    public static void copy(InputStream inputStream,
            OutputStream outputStream) throws IOException {

        byte[] buffer = new byte[8 * 1024];
        int count = 0;
        do {
            outputStream.write(buffer, 0, count);
            count = inputStream.read(buffer, 0, buffer.length);
        } while (count != -1);
    }
}

Related

  1. copy(InputStream in, OutputStream out)
  2. copy(InputStream in, OutputStream out)
  3. copy(InputStream input, OutputStream output)
  4. copy(InputStream input, Writer output)
  5. copy(InputStream input, Writer output, String encoding)
  6. copy(InputStream pSourceStream, OutputStream pTargetStream)
  7. copy(InputStream pSourceStream, OutputStream pTargetStream, boolean closeSource)
  8. copyContents(InputStream in, OutputStream out)
  9. copyFile(InputStream from, String target)