Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.desktop/share/classes/javax/print/attribute/standard/Destination.java
41171 views
1
/*
2
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
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
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
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
23
* questions.
24
*/
25
26
package javax.print.attribute.standard;
27
28
import java.io.File;
29
import java.io.Serial;
30
import java.net.URI;
31
32
import javax.print.attribute.Attribute;
33
import javax.print.attribute.PrintJobAttribute;
34
import javax.print.attribute.PrintRequestAttribute;
35
import javax.print.attribute.URISyntax;
36
37
/**
38
* Class {@code Destination} is a printing attribute class, a {@code URI}, that
39
* is used to indicate an alternate destination for the spooled printer
40
* formatted data. Many {@code PrintServices} will not support the notion of a
41
* destination other than the printer device, and so will not support this
42
* attribute.
43
* <p>
44
* A common use for this attribute will be applications which want to redirect
45
* output to a local disk file : eg."file:out.prn". Note that proper
46
* construction of "file:" scheme {@code URI} instances should be performed
47
* using the {@code toURI()} method of class {@link File File}. See the
48
* documentation on that class for more information.
49
* <p>
50
* If a destination {@code URI} is specified in a PrintRequest and it is not
51
* accessible for output by the {@code PrintService}, a {@code PrintException}
52
* will be thrown. The {@code PrintException} may implement {@code URIException}
53
* to provide a more specific cause.
54
* <p>
55
* <b>IPP Compatibility:</b> Destination is not an IPP attribute.
56
*
57
* @author Phil Race
58
*/
59
public final class Destination extends URISyntax
60
implements PrintJobAttribute, PrintRequestAttribute {
61
62
/**
63
* Use serialVersionUID from JDK 1.4 for interoperability.
64
*/
65
@Serial
66
private static final long serialVersionUID = 6776739171700415321L;
67
68
/**
69
* Constructs a new destination attribute with the specified {@code URI}.
70
*
71
* @param uri {@code URI}
72
* @throws NullPointerException if {@code uri} is {@code null}
73
*/
74
public Destination(URI uri) {
75
super (uri);
76
}
77
78
/**
79
* Returns whether this destination attribute is equivalent to the passed in
80
* object. To be equivalent, all of the following conditions must be true:
81
* <ol type=1>
82
* <li>{@code object} is not {@code null}.
83
* <li>{@code object} is an instance of class {@code Destination}.
84
* <li>This destination attribute's {@code URI} and {@code object}'s
85
* {@code URI} are equal.
86
* </ol>
87
*
88
* @param object {@code Object} to compare to
89
* @return {@code true} if {@code object} is equivalent to this destination
90
* attribute, {@code false} otherwise
91
*/
92
public boolean equals(Object object) {
93
return (super.equals(object) &&
94
object instanceof Destination);
95
}
96
97
/**
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 {@code Destination}, the category is class {@code Destination}
102
* itself.
103
*
104
* @return printing attribute class (category), an instance of class
105
* {@link Class java.lang.Class}
106
*/
107
public final Class<? extends Attribute> getCategory() {
108
return Destination.class;
109
}
110
111
/**
112
* Get the name of the category of which this attribute value is an
113
* instance.
114
* <p>
115
* For class {@code Destination}, the category name is
116
* {@code "spool-data-destination"}.
117
*
118
* @return attribute category name
119
*/
120
public final String getName() {
121
return "spool-data-destination";
122
}
123
}
124
125