jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Compression.java
changeset 47196 a3211bb4daff
parent 35667 ed476aba94de
equal deleted inserted replaced
47195:b309b58eb190 47196:a3211bb4daff
     1 /*
     1 /*
     2  * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    20  *
    20  *
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    22  * or visit www.oracle.com if you need additional information or have any
    22  * or visit www.oracle.com if you need additional information or have any
    23  * questions.
    23  * questions.
    24  */
    24  */
       
    25 
    25 package javax.print.attribute.standard;
    26 package javax.print.attribute.standard;
    26 
    27 
    27 import javax.print.attribute.Attribute;
    28 import javax.print.attribute.Attribute;
       
    29 import javax.print.attribute.DocAttribute;
    28 import javax.print.attribute.EnumSyntax;
    30 import javax.print.attribute.EnumSyntax;
    29 import javax.print.attribute.DocAttribute;
       
    30 
    31 
    31 /**
    32 /**
    32  * Class Compression is a printing attribute class, an enumeration, that
    33  * Class {@code Compression} is a printing attribute class, an enumeration, that
    33  * specifies how print data is compressed. Compression is an attribute of the
    34  * specifies how print data is compressed. {@code Compression} is an attribute
    34  * print data (the doc), not of the Print Job. If a Compression attribute is not
    35  * of the print data (the doc), not of the Print Job. If a {@code Compression}
    35  * specified for a doc, the printer assumes the doc's print data is uncompressed
    36  * attribute is not specified for a doc, the printer assumes the doc's print
    36  * (i.e., the default Compression value is always {@link #NONE
    37  * data is uncompressed (i.e., the default Compression value is always
    37  * NONE}).
    38  * {@link #NONE NONE}).
    38  * <P>
    39  * <p>
    39  * <B>IPP Compatibility:</B> The category name returned by
    40  * <b>IPP Compatibility:</b> The category name returned by {@code getName()} is
    40  * {@code getName()} is the IPP attribute name.  The enumeration's
    41  * the IPP attribute name. The enumeration's integer value is the IPP enum
    41  * integer value is the IPP enum value.  The {@code toString()} method
    42  * value. The {@code toString()} method returns the IPP string representation of
    42  * returns the IPP string representation of the attribute value.
    43  * the attribute value.
    43  *
    44  *
    44  * @author  Alan Kaminsky
    45  * @author Alan Kaminsky
    45  */
    46  */
    46 public class Compression extends EnumSyntax implements DocAttribute {
    47 public class Compression extends EnumSyntax implements DocAttribute {
    47 
    48 
       
    49     /**
       
    50      * Use serialVersionUID from JDK 1.4 for interoperability.
       
    51      */
    48     private static final long serialVersionUID = -5716748913324997674L;
    52     private static final long serialVersionUID = -5716748913324997674L;
    49 
    53 
    50     /**
    54     /**
    51      * No compression is used.
    55      * No compression is used.
    52      */
    56      */
    57      */
    61      */
    58     public static final Compression DEFLATE = new Compression(1);
    62     public static final Compression DEFLATE = new Compression(1);
    59 
    63 
    60     /**
    64     /**
    61      * GNU zip compression technology described in
    65      * GNU zip compression technology described in
    62      * <A HREF="http://www.ietf.org/rfc/rfc1952.txt">RFC 1952</A>.
    66      * <a href="http://www.ietf.org/rfc/rfc1952.txt">RFC 1952</a>.
    63      */
    67      */
    64     public static final Compression GZIP = new Compression(2);
    68     public static final Compression GZIP = new Compression(2);
    65 
    69 
    66     /**
    70     /**
    67      * UNIX compression technology.
    71      * UNIX compression technology.
    70 
    74 
    71     /**
    75     /**
    72      * Construct a new compression enumeration value with the given integer
    76      * Construct a new compression enumeration value with the given integer
    73      * value.
    77      * value.
    74      *
    78      *
    75      * @param  value  Integer value.
    79      * @param  value Integer value
    76      */
    80      */
    77     protected Compression(int value) {
    81     protected Compression(int value) {
    78         super(value);
    82         super(value);
    79     }
    83     }
    80 
    84 
    81 
    85     /**
       
    86      * The string table for class {@code Compression}.
       
    87      */
    82     private static final String[] myStringTable = {"none",
    88     private static final String[] myStringTable = {"none",
    83                                                    "deflate",
    89                                                    "deflate",
    84                                                    "gzip",
    90                                                    "gzip",
    85                                                    "compress"};
    91                                                    "compress"};
    86 
    92 
       
    93     /**
       
    94      * The enumeration value table for class {@code Compression}.
       
    95      */
    87     private static final Compression[] myEnumValueTable = {NONE,
    96     private static final Compression[] myEnumValueTable = {NONE,
    88                                                            DEFLATE,
    97                                                            DEFLATE,
    89                                                            GZIP,
    98                                                            GZIP,
    90                                                            COMPRESS};
    99                                                            COMPRESS};
    91 
   100 
    92     /**
   101     /**
    93      * Returns the string table for class Compression.
   102      * Returns the string table for class {@code Compression}.
    94      */
   103      */
    95     protected String[] getStringTable() {
   104     protected String[] getStringTable() {
    96         return myStringTable.clone();
   105         return myStringTable.clone();
    97     }
   106     }
    98 
   107 
    99     /**
   108     /**
   100      * Returns the enumeration value table for class Compression.
   109      * Returns the enumeration value table for class {@code Compression}.
   101      */
   110      */
   102     protected EnumSyntax[] getEnumValueTable() {
   111     protected EnumSyntax[] getEnumValueTable() {
   103         return (EnumSyntax[])myEnumValueTable.clone();
   112         return (EnumSyntax[])myEnumValueTable.clone();
   104     }
   113     }
   105 
   114 
   106     /**
   115     /**
   107      * Get the printing attribute class which is to be used as the "category"
   116      * Get the printing attribute class which is to be used as the "category"
   108      * for this printing attribute value.
   117      * for this printing attribute value.
   109      * <P>
   118      * <p>
   110      * For class Compression and any vendor-defined subclasses, the category is
   119      * For class {@code Compression} and any vendor-defined subclasses, the
   111      * class Compression itself.
   120      * category is class {@code Compression} itself.
   112      *
   121      *
   113      * @return  Printing attribute class (category), an instance of class
   122      * @return printing attribute class (category), an instance of class
   114      *          {@link java.lang.Class java.lang.Class}.
   123      *         {@link Class java.lang.Class}
   115      */
   124      */
   116     public final Class<? extends Attribute> getCategory() {
   125     public final Class<? extends Attribute> getCategory() {
   117         return Compression.class;
   126         return Compression.class;
   118     }
   127     }
   119 
   128 
   120     /**
   129     /**
   121      * Get the name of the category of which this attribute value is an
   130      * Get the name of the category of which this attribute value is an
   122      * instance.
   131      * instance.
   123      * <P>
   132      * <p>
   124      * For class Compression and any vendor-defined subclasses, the category
   133      * For class {@code Compression} and any vendor-defined subclasses, the
   125      * name is {@code "compression"}.
   134      * category name is {@code "compression"}.
   126      *
   135      *
   127      * @return  Attribute category name.
   136      * @return attribute category name
   128      */
   137      */
   129     public final String getName() {
   138     public final String getName() {
   130         return "compression";
   139         return "compression";
   131     }
   140     }
   132 
       
   133 }
   141 }