Path: blob/master/src/java.desktop/share/classes/javax/print/attribute/standard/Compression.java
41171 views
/*1* Copyright (c) 2000, 2021, 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*/2425package javax.print.attribute.standard;2627import java.io.Serial;2829import javax.print.attribute.Attribute;30import javax.print.attribute.DocAttribute;31import javax.print.attribute.EnumSyntax;3233/**34* Class {@code Compression} is a printing attribute class, an enumeration, that35* specifies how print data is compressed. {@code Compression} is an attribute36* of the print data (the doc), not of the Print Job. If a {@code Compression}37* attribute is not specified for a doc, the printer assumes the doc's print38* data is uncompressed (i.e., the default Compression value is always39* {@link #NONE NONE}).40* <p>41* <b>IPP Compatibility:</b> The category name returned by {@code getName()} is42* the IPP attribute name. The enumeration's integer value is the IPP enum43* value. The {@code toString()} method returns the IPP string representation of44* the attribute value.45*46* @author Alan Kaminsky47*/48public class Compression extends EnumSyntax implements DocAttribute {4950/**51* Use serialVersionUID from JDK 1.4 for interoperability.52*/53@Serial54private static final long serialVersionUID = -5716748913324997674L;5556/**57* No compression is used.58*/59public static final Compression NONE = new Compression(0);6061/**62* ZIP public domain inflate/deflate compression technology.63*/64public static final Compression DEFLATE = new Compression(1);6566/**67* GNU zip compression technology described in68* <a href="http://www.ietf.org/rfc/rfc1952.txt">RFC 1952</a>.69*/70public static final Compression GZIP = new Compression(2);7172/**73* UNIX compression technology.74*/75public static final Compression COMPRESS = new Compression(3);7677/**78* Construct a new compression enumeration value with the given integer79* value.80*81* @param value Integer value82*/83protected Compression(int value) {84super(value);85}8687/**88* The string table for class {@code Compression}.89*/90private static final String[] myStringTable = {"none",91"deflate",92"gzip",93"compress"};9495/**96* The enumeration value table for class {@code Compression}.97*/98private static final Compression[] myEnumValueTable = {NONE,99DEFLATE,100GZIP,101COMPRESS};102103/**104* Returns the string table for class {@code Compression}.105*/106protected String[] getStringTable() {107return myStringTable.clone();108}109110/**111* Returns the enumeration value table for class {@code Compression}.112*/113protected EnumSyntax[] getEnumValueTable() {114return (EnumSyntax[])myEnumValueTable.clone();115}116117/**118* Get the printing attribute class which is to be used as the "category"119* for this printing attribute value.120* <p>121* For class {@code Compression} and any vendor-defined subclasses, the122* category is class {@code Compression} itself.123*124* @return printing attribute class (category), an instance of class125* {@link Class java.lang.Class}126*/127public final Class<? extends Attribute> getCategory() {128return Compression.class;129}130131/**132* Get the name of the category of which this attribute value is an133* instance.134* <p>135* For class {@code Compression} and any vendor-defined subclasses, the136* category name is {@code "compression"}.137*138* @return attribute category name139*/140public final String getName() {141return "compression";142}143}144145146