KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > vfs > provider > gzip > GzipFileObject


1 /*
2  * Copyright 2002-2005 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.commons.vfs.provider.gzip;
17
18 import org.apache.commons.vfs.FileName;
19 import org.apache.commons.vfs.FileObject;
20 import org.apache.commons.vfs.provider.compressed.CompressedFileFileObject;
21 import org.apache.commons.vfs.provider.compressed.CompressedFileFileSystem;
22
23 import java.io.InputStream JavaDoc;
24 import java.io.OutputStream JavaDoc;
25 import java.util.zip.GZIPInputStream JavaDoc;
26 import java.util.zip.GZIPOutputStream JavaDoc;
27
28 /**
29  * the gzip file
30  *
31  * @author <a HREF="mailto:imario@apache.org">Mario Ivankovits</a>
32  */

33 public class GzipFileObject extends CompressedFileFileObject
34 {
35     protected GzipFileObject(FileName name, FileObject container, CompressedFileFileSystem fs)
36     {
37         super(name, container, fs);
38     }
39
40     protected InputStream JavaDoc doGetInputStream() throws Exception JavaDoc
41     {
42         InputStream JavaDoc is = getContainer().getContent().getInputStream();
43         return new GZIPInputStream JavaDoc(is);
44     }
45
46     protected OutputStream JavaDoc doGetOutputStream(boolean bAppend) throws Exception JavaDoc
47     {
48         OutputStream JavaDoc os = getContainer().getContent().getOutputStream(false);
49         return new GZIPOutputStream JavaDoc(os);
50     }
51 }
52
Popular Tags