KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > print > attribute > standard > Compression


1 /*
2  * @(#)Compression.java 1.8 04/05/05
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7 package javax.print.attribute.standard;
8
9 import javax.print.attribute.Attribute JavaDoc;
10 import javax.print.attribute.EnumSyntax JavaDoc;
11 import javax.print.attribute.DocAttribute JavaDoc;
12
13 /**
14  * Class Compression is a printing attribute class, an enumeration, that
15  * specifies how print data is compressed. Compression is an attribute of the
16  * print data (the doc), not of the Print Job. If a Compression attribute is not
17  * specified for a doc, the printer assumes the doc's print data is uncompressed
18  * (i.e., the default Compression value is always {@link #NONE
19  * <CODE>NONE</CODE>}).
20  * <P>
21  * <B>IPP Compatibility:</B> The category name returned by
22  * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's
23  * integer value is the IPP enum value. The <code>toString()</code> method
24  * returns the IPP string representation of the attribute value.
25  * <P>
26  *
27  * @author Alan Kaminsky
28  */

29 public class Compression extends EnumSyntax JavaDoc implements DocAttribute JavaDoc {
30
31     private static final long serialVersionUID = -5716748913324997674L;
32
33     /**
34      * No compression is used.
35      */

36     public static final Compression JavaDoc NONE = new Compression JavaDoc(0);
37
38     /**
39      * ZIP public domain inflate/deflate compression technology.
40      */

41     public static final Compression JavaDoc DEFLATE = new Compression JavaDoc(1);
42
43     /**
44      * GNU zip compression technology described in
45      * <A HREF="http://www.ietf.org/rfc/rfc1952.txt">RFC 1952</A>.
46      */

47     public static final Compression JavaDoc GZIP = new Compression JavaDoc(2);
48
49     /**
50      * UNIX compression technology.
51      */

52     public static final Compression JavaDoc COMPRESS = new Compression JavaDoc(3);
53
54     /**
55      * Construct a new compression enumeration value with the given integer
56      * value.
57      *
58      * @param value Integer value.
59      */

60     protected Compression(int value) {
61     super(value);
62     }
63
64
65     private static final String JavaDoc[] myStringTable = {"none",
66                            "deflate",
67                            "gzip",
68                            "compress"};
69
70     private static final Compression JavaDoc[] myEnumValueTable = {NONE,
71                                DEFLATE,
72                                GZIP,
73                                COMPRESS};
74
75     /**
76      * Returns the string table for class Compression.
77      */

78     protected String JavaDoc[] getStringTable() {
79     return (String JavaDoc[])myStringTable.clone();
80     }
81
82     /**
83      * Returns the enumeration value table for class Compression.
84      */

85     protected EnumSyntax JavaDoc[] getEnumValueTable() {
86     return (EnumSyntax JavaDoc[])myEnumValueTable.clone();
87     }
88
89     /**
90      * Get the printing attribute class which is to be used as the "category"
91      * for this printing attribute value.
92      * <P>
93      * For class Compression and any vendor-defined subclasses, the category is
94      * class Compression itself.
95      *
96      * @return Printing attribute class (category), an instance of class
97      * {@link java.lang.Class java.lang.Class}.
98      */

99     public final Class JavaDoc<? extends Attribute JavaDoc> getCategory() {
100     return Compression JavaDoc.class;
101     }
102
103     /**
104      * Get the name of the category of which this attribute value is an
105      * instance.
106      * <P>
107      * For class Compression and any vendor-defined subclasses, the category
108      * name is <CODE>"compression"</CODE>.
109      *
110      * @return Attribute category name.
111      */

112     public final String JavaDoc getName() {
113     return "compression";
114     }
115
116 }
117
Popular Tags