Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/print/attribute/standard/Destination.java
38918 views
/*1* Copyright (c) 2000, 2004, 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 java.net.URI;2728import javax.print.attribute.Attribute;29import javax.print.attribute.URISyntax;30import javax.print.attribute.PrintRequestAttribute;31import javax.print.attribute.PrintJobAttribute;3233/**34* Class Destination is a printing attribute class, a URI, that is used to35* indicate an alternate destination for the spooled printer formatted36* data. Many PrintServices will not support the notion of a destination37* other than the printer device, and so will not support this attribute.38* <p>39* A common use for this attribute will be applications which want40* to redirect output to a local disk file : eg."file:out.prn".41* Note that proper construction of "file:" scheme URI instances should42* be performed using the <code>toURI()</code> method of class43* {@link java.io.File File}.44* See the documentation on that class for more information.45* <p>46* If a destination URI is specified in a PrintRequest and it is not47* accessible for output by the PrintService, a PrintException will be thrown.48* The PrintException may implement URIException to provide a more specific49* cause.50* <P>51* <B>IPP Compatibility:</B> Destination is not an IPP attribute.52* <P>53*54* @author Phil Race.55*/56public final class Destination extends URISyntax57implements PrintJobAttribute, PrintRequestAttribute {5859private static final long serialVersionUID = 6776739171700415321L;6061/**62* Constructs a new destination attribute with the specified URI.63*64* @param uri URI.65*66* @exception NullPointerException67* (unchecked exception) Thrown if <CODE>uri</CODE> is null.68*/69public Destination(URI uri) {70super (uri);71}7273/**74* Returns whether this destination attribute is equivalent to the75* passed in object. To be equivalent, all of the following conditions76* must be true:77* <OL TYPE=1>78* <LI>79* <CODE>object</CODE> is not null.80* <LI>81* <CODE>object</CODE> is an instance of class Destination.82* <LI>83* This destination attribute's URI and <CODE>object</CODE>'s URI84* are equal.85* </OL>86*87* @param object Object to compare to.88*89* @return True if <CODE>object</CODE> is equivalent to this destination90* attribute, false otherwise.91*/92public boolean equals(Object object) {93return (super.equals(object) &&94object instanceof Destination);95}9697/**98* Get the printing attribute class which is to be used as the "category"99* for this printing attribute value.100* <P>101* For class Destination, the category is class Destination itself.102*103* @return Printing attribute class (category), an instance of class104* {@link java.lang.Class java.lang.Class}.105*/106public final Class<? extends Attribute> getCategory() {107return Destination.class;108}109110/**111* Get the name of the category of which this attribute value is an112* instance.113* <P>114* For class Destination, the category name is <CODE>"spool-data-destination"</CODE>.115*116* @return Attribute category name.117*/118public final String getName() {119return "spool-data-destination";120}121122}123124125