01: /*
02: * Gruntspud
03: *
04: * Copyright (C) 2002 Brett Smith.
05: *
06: * Written by: Brett Smith <t_magicthize@users.sourceforge.net>
07: *
08: * This program is free software; you can redistribute it and/or
09: * modify it under the terms of the GNU Library General Public License
10: * as published by the Free Software Foundation; either version 2 of
11: * the License, or (at your option) any later version.
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: * GNU Library General Public License for more details.
16: *
17: * You should have received a copy of the GNU Library General Public
18: * License along with this program; if not, write to the Free Software
19: * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20: *
21: *
22: * See note in <code>GruntspudFileHandler</code> for more information
23: * on the origin of this code
24: */
25: package gruntspud.file;
26:
27: import gruntspud.GruntspudContext;
28:
29: import java.io.File;
30: import java.io.FileInputStream;
31: import java.io.IOException;
32: import java.io.InputStream;
33: import java.io.InputStreamReader;
34: import java.io.Reader;
35: import java.util.zip.GZIPInputStream;
36:
37: import org.netbeans.lib.cvsclient.file.TransmitTextFilePreprocessor;
38: import org.netbeans.lib.cvsclient.file.WriteTextFilePreprocessor;
39: import org.netbeans.lib.cvsclient.request.GzipStreamRequest;
40: import org.netbeans.lib.cvsclient.request.Request;
41:
42: public class GruntspudGZIPFileHandler extends GruntspudFileHandler {
43:
44: public GruntspudGZIPFileHandler(GruntspudContext context,
45: TransmitTextFilePreprocessor transmitTextFilePreprocessor,
46: WriteTextFilePreprocessor writeTextFilePreprocessor,
47: WriteTextFilePreprocessor writeRcsDiffFilePreprocessor) {
48: super (context, transmitTextFilePreprocessor,
49: writeTextFilePreprocessor, writeRcsDiffFilePreprocessor);
50: }
51:
52: private boolean isCompressed;
53:
54: public Request[] getInitialisationRequests() {
55: return new Request[] { new GzipStreamRequest() };
56: }
57:
58: protected Reader getProcessedReader(File f) throws IOException {
59: return new InputStreamReader(new GZIPInputStream(
60: new FileInputStream(f)));
61: }
62:
63: protected InputStream getProcessedInputStream(File f)
64: throws IOException {
65: return new GZIPInputStream(new FileInputStream(f));
66: }
67: }
|