Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/print/attribute/standard/Compression.java
38918 views
/*1* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/24package javax.print.attribute.standard;2526import javax.print.attribute.Attribute;27import javax.print.attribute.EnumSyntax;28import javax.print.attribute.DocAttribute;2930/**31* Class Compression is a printing attribute class, an enumeration, that32* specifies how print data is compressed. Compression is an attribute of the33* print data (the doc), not of the Print Job. If a Compression attribute is not34* specified for a doc, the printer assumes the doc's print data is uncompressed35* (i.e., the default Compression value is always {@link #NONE36* NONE}).37* <P>38* <B>IPP Compatibility:</B> The category name returned by39* <CODE>getName()</CODE> is the IPP attribute name. The enumeration's40* integer value is the IPP enum value. The <code>toString()</code> method41* returns the IPP string representation of the attribute value.42* <P>43*44* @author Alan Kaminsky45*/46public class Compression extends EnumSyntax implements DocAttribute {4748private static final long serialVersionUID = -5716748913324997674L;4950/**51* No compression is used.52*/53public static final Compression NONE = new Compression(0);5455/**56* ZIP public domain inflate/deflate compression technology.57*/58public static final Compression DEFLATE = new Compression(1);5960/**61* GNU zip compression technology described in62* <A HREF="http://www.ietf.org/rfc/rfc1952.txt">RFC 1952</A>.63*/64public static final Compression GZIP = new Compression(2);6566/**67* UNIX compression technology.68*/69public static final Compression COMPRESS = new Compression(3);7071/**72* Construct a new compression enumeration value with the given integer73* value.74*75* @param value Integer value.76*/77protected Compression(int value) {78super(value);79}808182private static final String[] myStringTable = {"none",83"deflate",84"gzip",85"compress"};8687private static final Compression[] myEnumValueTable = {NONE,88DEFLATE,89GZIP,90COMPRESS};9192/**93* Returns the string table for class Compression.94*/95protected String[] getStringTable() {96return (String[])myStringTable.clone();97}9899/**100* Returns the enumeration value table for class Compression.101*/102protected EnumSyntax[] getEnumValueTable() {103return (EnumSyntax[])myEnumValueTable.clone();104}105106/**107* Get the printing attribute class which is to be used as the "category"108* for this printing attribute value.109* <P>110* For class Compression and any vendor-defined subclasses, the category is111* class Compression itself.112*113* @return Printing attribute class (category), an instance of class114* {@link java.lang.Class java.lang.Class}.115*/116public final Class<? extends Attribute> getCategory() {117return Compression.class;118}119120/**121* Get the name of the category of which this attribute value is an122* instance.123* <P>124* For class Compression and any vendor-defined subclasses, the category125* name is <CODE>"compression"</CODE>.126*127* @return Attribute category name.128*/129public final String getName() {130return "compression";131}132133}134135136