blob: 177428390a44ee7b3a5abf9f1d006d9e3266bfc5 [file] [log] [blame]
Torsten Curdtca165392008-07-10 10:17:44 +00001/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19package org.apache.commons.compress.compressors.gzip;
20
21import java.io.IOException;
22import java.io.OutputStream;
23import java.util.zip.GZIPOutputStream;
24
25import org.apache.commons.compress.compressors.CompressorOutputStream;
26
27public class GzipCompressorOutputStream extends CompressorOutputStream {
Torsten Curdtca165392008-07-10 10:17:44 +000028
Stefan Bodewig90a05f72009-02-10 15:11:22 +000029 private final GZIPOutputStream out;
30
Stefan Bodewig3f9bcc62009-02-10 14:20:05 +000031 public GzipCompressorOutputStream( final OutputStream outputStream ) throws IOException {
Stefan Bodewig90a05f72009-02-10 15:11:22 +000032 out = new GZIPOutputStream(outputStream);
33 }
34
Stefan Bodewig46628ef2011-08-06 16:30:40 +000035 @Override
Stefan Bodewig90a05f72009-02-10 15:11:22 +000036 public void write(int b) throws IOException {
37 out.write(b);
38 }
39
Sebastian Bazley6209f812010-05-10 17:36:40 +000040 /**
41 * {@inheritDoc}
42 *
Gary D. Gregory2bd0dd42012-04-01 13:02:39 +000043 * @since 1.1
Sebastian Bazley6209f812010-05-10 17:36:40 +000044 */
Stefan Bodewig46628ef2011-08-06 16:30:40 +000045 @Override
Stefan Bodewig381d4a62009-08-01 20:17:00 +000046 public void write(byte[] b) throws IOException {
47 out.write(b);
48 }
49
Sebastian Bazley6209f812010-05-10 17:36:40 +000050 /**
51 * {@inheritDoc}
52 *
Gary D. Gregory2bd0dd42012-04-01 13:02:39 +000053 * @since 1.1
Sebastian Bazley6209f812010-05-10 17:36:40 +000054 */
Stefan Bodewig46628ef2011-08-06 16:30:40 +000055 @Override
Stefan Bodewig381d4a62009-08-01 20:17:00 +000056 public void write(byte[] b, int from, int length) throws IOException {
57 out.write(b, from, length);
58 }
59
Stefan Bodewig46628ef2011-08-06 16:30:40 +000060 @Override
Stefan Bodewig90a05f72009-02-10 15:11:22 +000061 public void close() throws IOException {
62 out.close();
Stefan Bodewig3f9bcc62009-02-10 14:20:05 +000063 }
Torsten Curdtca165392008-07-10 10:17:44 +000064
65}