java.lang.Objectjavax.print.PrintServiceLookup
public abstract class PrintServiceLookup
Implementations of this class provide lookup services for print services (typically equivalent to printers) of a particular type.
Multiple implementations may be installed concurrently. All implementations must be able to describe the located printers as instances of a PrintService. Typically implementations of this service class are located automatically in JAR files (see the SPI JAR file specification). These classes must be instantiable using a default constructor. Alternatively applications may explicitly register instances at runtime.
Applications use only the static methods of this abstract class. The instance methods are implemented by a service provider in a subclass and the unification of the results from all installed lookup classes are reported by the static methods of this class when called by the application.
A PrintServiceLookup implementor is recommended to check for the SecurityManager.checkPrintJobAccess() to deny access to untrusted code. Following this recommended policy means that untrusted code may not be able to locate any print services. Downloaded applets are the most common example of untrusted code.
This check is made on a per lookup service basis to allow flexibility in the policy to reflect the needs of different lookup services.
Services which are registered by registerService(PrintService) will not be included in lookup results if a security manager is installed and its checkPrintJobAccess() method denies access.
| Constructor Summary | |
|---|---|
PrintServiceLookup()
|
|
| Method Summary | |
|---|---|
abstract PrintService |
getDefaultPrintService()
Not called directly by applications. |
abstract MultiDocPrintService[] |
getMultiDocPrintServices(DocFlavor[] flavors,
AttributeSet attributes)
Not called directly by applications. |
abstract PrintService[] |
getPrintServices()
Not called directly by applications. |
abstract PrintService[] |
getPrintServices(DocFlavor flavor,
AttributeSet attributes)
Locates services that can be positively confirmed to support the combination of attributes and DocFlavors specified. |
static PrintService |
lookupDefaultPrintService()
Locates the default print service for this environment. |
static MultiDocPrintService[] |
lookupMultiDocPrintServices(DocFlavor[] flavors,
AttributeSet attributes)
Locates MultiDoc print Services capable of printing MultiDocs containing all the specified doc flavors. |
static PrintService[] |
lookupPrintServices(DocFlavor flavor,
AttributeSet attributes)
Locates print services capable of printing the specified DocFlavor. |
static boolean |
registerService(PrintService service)
Allows an application to directly register an instance of a class which implements a print service. |
static boolean |
registerServiceProvider(PrintServiceLookup sp)
Allows an application to explicitly register a class that implements lookup services. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PrintServiceLookup()
| Method Detail |
|---|
public static final PrintService[] lookupPrintServices(DocFlavor flavor, AttributeSet attributes)
DocFlavor.
flavor - the flavor to print. If null, this constraint is not
used.attributes - attributes that the print service must support.
If null this constraint is not used.
PrintService objects
representing print services that support the specified flavor
attributes. If no services match, the array is zero-length.public static final MultiDocPrintService[] lookupMultiDocPrintServices(DocFlavor[] flavors, AttributeSet attributes)
This method is useful to help locate a service that can print
a MultiDoc in which the elements may be different
flavors. An application could perform this itself by multiple lookups
on each DocFlavor in turn and collating the results,
but the lookup service may be able to do this more efficiently.
flavors - the flavors to print. If null or empty this
constraint is not used.
Otherwise return only multidoc print services that can print all
specified doc flavors.attributes - attributes that the print service must
support. If null this constraint is not used.
MultiDocPrintService objects.
If no services match, the array is zero-length.public static final PrintService lookupDefaultPrintService()
This may include making use of any preferences API that is available as part of the Java or native platform. This algorithm may be overridden by a user setting the property javax.print.defaultPrinter. A service specified must be discovered to be valid and currently available to be returned as the default.
public static boolean registerServiceProvider(PrintServiceLookup sp)
sp - an implementation of a lookup service.
true if the new lookup service is newly
registered; false otherwise.public static boolean registerService(PrintService service)
PrintServiceLookup instance
instead is recommended.
The method returns true if this service is not previously
registered and is now successfully registered.
This method should not be called with StreamPrintService instances.
They will always fail to register and the method will return false.
service - an implementation of a print service.
true if the service is newly
registered; false otherwise.public abstract PrintService[] getPrintServices(DocFlavor flavor, AttributeSet attributes)
Implemented by a service provider, used by the static methods of this class.
The results should be the same as obtaining all the PrintServices and querying each one individually on its support for the specified attributes and flavors, but the process can be more efficient by taking advantage of the capabilities of lookup services for the print services.
flavor - of document required. If null it is ignored.attributes - required to be supported. If null this
constraint is not used.
public abstract PrintService[] getPrintServices()
public abstract MultiDocPrintService[] getMultiDocPrintServices(DocFlavor[] flavors, AttributeSet attributes)
Implemented by a service provider, used by the static methods of this class.
Locates MultiDoc print services which can be positively confirmed to support the combination of attributes and DocFlavors specified.
flavors - of documents required. If null or empty it is ignored.attributes - required to be supported. If null this
constraint is not used.
public abstract PrintService getDefaultPrintService()
Ces informations proviennent du site de http://java.sun.com
Le contenu de cette page provient du site de Sun, et est généré depuis un cache sur l'infobrol après certains traitements automatisés. La présentation peut donc différer du document original, mais le contenu aussi. Vous pouvez utiliser ce bouton pour afficher la page originale du site de Sun :
Maintenir les pages en cache sur différents sites peut offrir plus de disponibilité.
Chaque page est indexée dans la base de donnée, ce qui permet de retrouver facilement les informations, au moyen des sommaires, du moteur de recherche interne, etc.
Des facilités sont mises en place pour que les membres de l'infobrol puissent effectuer des traductions en français des différents documents. Ceci devrait permettre aux débutants en programmation Java de consulter les API en français s'ils maîtrisent moins bien la langue de Shakespeare. Dans le cas où une traduction a été soumise, elle est disponible au moyen d'un lien en bas de page. Si la traduction a été validée, la page s'affiche par défaut en français, et un lien en bas de page permet d'atteindre la version en anglais.
Le code sur l'infobrol est automatiquement coloré selon la syntaxe, et les différents mots clés sont transformés en liens pour accéder rapidement aux informations.
Vous avez la possibilité de partager vos expériences en proposant vos propres extraits de code en utilisant le bouton "ajouter un commentaire" en bas de page. Si vous visitez simplement l'infobrol, vous avez déjà accès à cette fonction, mais si vous étes membre du brol, vous pouvez en plus utiliser des boutons supplémentaires de mise en forme, dont la coloration automatique de vos extraits de codes.
Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.
6 mots clés dont 0 définis manuellement (plus d'information...).
Avertissement
Cette page ne possède pas encore de mots clés manuels, ceci est donc un exemple automatique (les niveaux de pertinence sont fictifs, mais les liens sont valables). Pour tester le nuage avec une page qui contient des mots définis manuellement, vous pouvez cliquer ici.Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher le nuage de mots clés.
Recherche (afficher)
Utilisateur (masquer)
Navigation (masquer)
Apparence (afficher)
Stats (afficher)
Citation (masquer)