Path: blob/master/src/java.desktop/share/classes/javax/print/attribute/standard/Destination.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.File;28import java.io.Serial;29import java.net.URI;3031import javax.print.attribute.Attribute;32import javax.print.attribute.PrintJobAttribute;33import javax.print.attribute.PrintRequestAttribute;34import javax.print.attribute.URISyntax;3536/**37* Class {@code Destination} is a printing attribute class, a {@code URI}, that38* is used to indicate an alternate destination for the spooled printer39* formatted data. Many {@code PrintServices} will not support the notion of a40* destination other than the printer device, and so will not support this41* attribute.42* <p>43* A common use for this attribute will be applications which want to redirect44* output to a local disk file : eg."file:out.prn". Note that proper45* construction of "file:" scheme {@code URI} instances should be performed46* using the {@code toURI()} method of class {@link File File}. See the47* documentation on that class for more information.48* <p>49* If a destination {@code URI} is specified in a PrintRequest and it is not50* accessible for output by the {@code PrintService}, a {@code PrintException}51* will be thrown. The {@code PrintException} may implement {@code URIException}52* to provide a more specific cause.53* <p>54* <b>IPP Compatibility:</b> Destination is not an IPP attribute.55*56* @author Phil Race57*/58public final class Destination extends URISyntax59implements PrintJobAttribute, PrintRequestAttribute {6061/**62* Use serialVersionUID from JDK 1.4 for interoperability.63*/64@Serial65private static final long serialVersionUID = 6776739171700415321L;6667/**68* Constructs a new destination attribute with the specified {@code URI}.69*70* @param uri {@code URI}71* @throws NullPointerException if {@code uri} is {@code null}72*/73public Destination(URI uri) {74super (uri);75}7677/**78* Returns whether this destination attribute is equivalent to the passed in79* object. To be equivalent, all of the following conditions must be true:80* <ol type=1>81* <li>{@code object} is not {@code null}.82* <li>{@code object} is an instance of class {@code Destination}.83* <li>This destination attribute's {@code URI} and {@code object}'s84* {@code URI} are equal.85* </ol>86*87* @param object {@code Object} to compare to88* @return {@code true} if {@code object} is equivalent to this destination89* attribute, {@code false} otherwise90*/91public boolean equals(Object object) {92return (super.equals(object) &&93object instanceof Destination);94}9596/**97* Get the printing attribute class which is to be used as the "category"98* for this printing attribute value.99* <p>100* For class {@code Destination}, the category is class {@code Destination}101* itself.102*103* @return printing attribute class (category), an instance of class104* {@link 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 {@code Destination}, the category name is115* {@code "spool-data-destination"}.116*117* @return attribute category name118*/119public final String getName() {120return "spool-data-destination";121}122}123124125