Here you can find the source of copy(InputStream inputStream, OutputStream outputStream)
Parameter | Description |
---|---|
inputStream | the GZIPInputStream . |
outputStream | the OutputStream . |
Parameter | Description |
---|---|
IOException | error handling files. |
public static void copy(InputStream inputStream, OutputStream outputStream) throws IOException
//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); } }