1 /* ZNet - Java Compression Layer for a new Socket Factory
2 Copyright (C) 1999, Free Software Rulez
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 The author of this program may be contacted at morgiaclaudio@yahoo.it. */
19
20 package java.net;
21
22 /**
23 * This interface models the common methods that every compressor must provide
24 * in order to be used as a "plugin" into the compression layer.
25 * The interface scheme is based on the {@link java.util.zip.Deflater Deflater}
26 * class, the standard compression engine available in every JVM.
27 * If you want to provide a new compression engine, you have to implement this
28 * interface and pass the class name as the property <b>compressor</b>:<br>
29 * java -Dcompressor=java.net.DeflatingCompressor ....
30 * @see java.net.DeflatingCompressor
31 * @author <a href="mailto:morgiaclaudio@yahoo.it">Claudio Morgia</a>
32 * @version 1.0
33 */
34 public interface Compressor {
35 /**
36 * @see java.util.zip.Deflater#deflate(byte[]) deflate(byte[])
37 */
38 public int deflate(byte[] b);
39
40 /**
41 * @see java.util.zip.Deflater#deflate(byte[],int,int) deflate(byte[],int,int)
42 */
43 public int deflate(byte[] b, int off, int len);
44
45 /**
46 * @see java.util.zip.Deflater#end() end()
47 */
48 public void end();
49
50 /**
51 * @see java.util.zip.Deflater#finish() finish()
52 */
53 public void finish();
54
55 /**
56 * @see java.util.zip.Deflater#finished() finished()
57 */
58 public boolean finished();
59
60 /**
61 * @see java.util.zip.Deflater#getAdler() getAdler()
62 */
63 public int getAdler();
64
65 /**
66 * @see java.util.zip.Deflater#getTotalIn() getTotalIn()
67 */
68 public int getTotalIn();
69
70 /**
71 * @see java.util.zip.Deflater#getTotalOut() getTotalOut()
72 */
73 public int getTotalOut();
74
75 /**
76 * @see java.util.zip.Deflater#needsInput() needsInput()
77 */
78 public boolean needsInput();
79
80 /**
81 * @see java.util.zip.Deflater#reset() reset()
82 */
83 public void reset();
84
85 /**
86 * @see java.util.zip.Deflater#setDictionary(byte[]) setDictionary(byte[])
87 */
88 public void setDictionary(byte[] dic);
89
90 /**
91 * @see java.util.zip.Deflater#setDictionary(byte[],int,int) setDictionary(byte[],int,int)
92 */
93 public void setDictionary(byte[] dic, int off, int len);
94
95 /**
96 * @see java.util.zip.Deflater#setInput(byte[]) setInput(byte[])
97 */
98 public void setInput(byte[] b);
99
100 /**
101 * @see java.util.zip.Deflater#setInput(byte[],int,int) setInput(byte[],int,int)
102 */
103 public void setInput(byte[] b, int off, int len);
104
105 /**
106 * @see java.util.zip.Deflater#setLevel(int) setLevel(int)
107 */
108 public void setLevel(int l);
109
110 /**
111 * @see java.util.zip.Deflater#setStrategy(int) setStrategy(int)
112 */
113 public void setStrategy(int st);
114
115 /**
116 * This method isn't present in the original java.net.Deflater but it's
117 * really useful.
118 * @return the working level of the compression engine
119 */
120 public int getLevel();
121
122 /**
123 * This method returns information about the compression engine capabilities,
124 * as the number of supported compression levels.
125 * @return the number of supported levels
126 */
127 public int getLevels();
128 }