< prev index next >

src/java.desktop/share/classes/javax/print/attribute/standard/Destination.java

Print this page


   1 /*
   2  * Copyright (c) 2000, 2014, 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 package javax.print.attribute.standard;
  26 

  27 import java.net.URI;
  28 
  29 import javax.print.attribute.Attribute;
  30 import javax.print.attribute.URISyntax;
  31 import javax.print.attribute.PrintRequestAttribute;
  32 import javax.print.attribute.PrintJobAttribute;


  33 
  34 /**
  35  * Class Destination is a printing attribute class, a URI, that is used to
  36  * indicate an alternate destination for the spooled printer formatted
  37  * data. Many PrintServices will not support the notion of a destination
  38  * other than the printer device, and so will not support this attribute.







  39  * <p>
  40  * A common use for this attribute will be applications which want
  41  * to redirect output to a local disk file : eg."file:out.prn".
  42  * Note that proper construction of "file:" scheme URI instances should
  43  * be performed using the {@code toURI()} method of class
  44  * {@link java.io.File File}.
  45  * See the documentation on that class for more information.
  46  * <p>
  47  * If a destination URI is specified in a PrintRequest and it is not
  48  * accessible for output by the PrintService, a PrintException will be thrown.
  49  * The PrintException may implement URIException to provide a more specific
  50  * cause.
  51  * <P>
  52  * <B>IPP Compatibility:</B> Destination is not an IPP attribute.
  53  *
  54  * @author  Phil Race.
  55  */
  56 public final class Destination extends URISyntax
  57         implements PrintJobAttribute, PrintRequestAttribute {
  58 



  59     private static final long serialVersionUID = 6776739171700415321L;
  60 
  61     /**
  62      * Constructs a new destination attribute with the specified URI.
  63      *
  64      * @param  uri  URI.
  65      *
  66      * @exception  NullPointerException
  67      *     (unchecked exception) Thrown if {@code uri} is null.
  68      */
  69     public Destination(URI uri) {
  70         super (uri);
  71     }
  72 
  73     /**
  74      * Returns whether this destination attribute is equivalent to the
  75      * passed in object. To be equivalent, all of the following conditions
  76      * must be true:
  77      * <OL TYPE=1>
  78      * <LI>
  79      * {@code object} is not null.
  80      * <LI>
  81      * {@code object} is an instance of class Destination.
  82      * <LI>
  83      * This destination attribute's URI and {@code object}'s URI
  84      * are equal.
  85      * </OL>
  86      *
  87      * @param  object  Object to compare to.
  88      *
  89      * @return  True if {@code object} is equivalent to this destination
  90      *         attribute, 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 Destination, the category is class Destination itself.

 102      *
 103      * @return  Printing attribute class (category), an instance of class
 104      *          {@link java.lang.Class java.lang.Class}.
 105      */
 106     public final Class<? extends Attribute> getCategory() {
 107         return Destination.class;
 108     }
 109 
 110     /**
 111      * Get the name of the category of which this attribute value is an
 112      * instance.
 113      * <P>
 114      * For class Destination, the category name is {@code "spool-data-destination"}.

 115      *
 116      * @return  Attribute category name.
 117      */
 118     public final String getName() {
 119         return "spool-data-destination";
 120     }
 121 
 122 }
   1 /*
   2  * Copyright (c) 2000, 2017, 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.net.URI;
  30 
  31 import javax.print.attribute.Attribute;


  32 import javax.print.attribute.PrintJobAttribute;
  33 import javax.print.attribute.PrintRequestAttribute;
  34 import javax.print.attribute.URISyntax;
  35 
  36 /**
  37  * Class {@code Destination} is a printing attribute class, a {@code URI}, that
  38  * is used to indicate an alternate destination for the spooled printer
  39  * formatted data. Many {@code PrintServices} will not support the notion of a
  40  * destination other than the printer device, and so will not support this
  41  * attribute.
  42  * <p>
  43  * A common use for this attribute will be applications which want to redirect
  44  * output to a local disk file : eg."file:out.prn". Note that proper
  45  * construction of "file:" scheme {@code URI} instances should be performed
  46  * using the {@code toURI()} method of class {@link File File}. See the
  47  * documentation on that class for more information.
  48  * <p>
  49  * If a destination {@code URI} is specified in a PrintRequest and it is not
  50  * 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 Race
  57  */
  58 public final class Destination extends URISyntax
  59         implements PrintJobAttribute, PrintRequestAttribute {
  60 
  61     /**
  62      * Use serialVersionUID from JDK 1.4 for interoperability.
  63      */
  64     private static final long serialVersionUID = 6776739171700415321L;
  65 
  66     /**
  67      * Constructs a new destination attribute with the specified {@code URI}.


  68      *
  69      * @param  uri {@code URI}
  70      * @throws NullPointerException if {@code uri} is {@code null}
  71      */
  72     public Destination(URI uri) {
  73         super (uri);
  74     }
  75 
  76     /**
  77      * Returns whether this destination attribute is equivalent to the passed in
  78      * object. To be equivalent, all of the following conditions must be true:
  79      * <ol type=1>
  80      *   <li>{@code object} is not {@code null}.
  81      *   <li>{@code object} is an instance of class {@code Destination}.
  82      *   <li>This destination attribute's {@code URI} and {@code object}'s
  83      *   {@code URI} are equal.
  84      * </ol>
  85      *
  86      * @param  object {@code Object} to compare to
  87      * @return {@code true} if {@code object} is equivalent to this destination
  88      *         attribute, {@code false} otherwise





  89      */
  90     public boolean equals(Object object) {
  91         return (super.equals(object) &&
  92                 object instanceof Destination);
  93     }
  94 
  95     /**
  96      * Get the printing attribute class which is to be used as the "category"
  97      * for this printing attribute value.
  98      * <p>
  99      * For class {@code Destination}, the category is class {@code Destination}
 100      * itself.
 101      *
 102      * @return printing attribute class (category), an instance of class
 103      *         {@link Class java.lang.Class}
 104      */
 105     public final Class<? extends Attribute> getCategory() {
 106         return Destination.class;
 107     }
 108 
 109     /**
 110      * Get the name of the category of which this attribute value is an
 111      * instance.
 112      * <p>
 113      * For class {@code Destination}, the category name is
 114      * {@code "spool-data-destination"}.
 115      *
 116      * @return attribute category name
 117      */
 118     public final String getName() {
 119         return "spool-data-destination";
 120     }

 121 }
< prev index next >