StreamPrintServiceFactoryis the factory for
StreamPrintServiceinstances, which can print to an output stream in a particular document format described as a mime type. A typical output document format may be Postscript(TM).
This class is implemented by a service and located by the implementation
Applications locate instances of this class by calling the
lookupStreamPrintServiceFactories(DocFlavor, String) method.
Applications can use a
StreamPrintService obtained from a factory in
place of a
PrintService which represents a physical printer device.
()Constructor for subclasses to call.
Method SummaryModifier and TypeMethodDescription
()Queries the factory for the document format that is emitted by printers obtained from this factory.
OutputStream out)(Returns a
StreamPrintServicethat can print to the specified output stream.
()Queries the factory for the document flavors that can be accepted by printers obtained from this factory.
static StreamPrintServiceFactoryLocates factories for print services that can be used with a print job to output a stream of data in the format specified by
StreamPrintServiceFactoryprotected StreamPrintServiceFactory()Constructor for subclasses to call.
lookupStreamPrintServiceFactoriespublic static StreamPrintServiceFactory lookupStreamPrintServiceFactories(DocFlavor flavor, String outputMimeType)Locates factories for print services that can be used with a print job to output a stream of data in the format specified by
outputMimeTypeparameter describes the document type that you want to create, whereas the
flavorparameter describes the format in which the input data will be provided by the application to the
nullis an acceptable value to use in the lookup of stream printing services, it's typical to search for a particular desired format, such as Postscript(TM).
flavor- of the input document type -
nullmeans match all types
outputMimeType- representing the required output format, used to identify suitable stream printer factories. A value of
nullmeans match all formats.
- matching factories for stream print service instance, empty if no suitable factories could be located
getOutputFormatpublic abstract String getOutputFormat()Queries the factory for the document format that is emitted by printers obtained from this factory.
- the output format described as a mime type
getSupportedDocFlavorspublic abstract DocFlavor getSupportedDocFlavors()Queries the factory for the document flavors that can be accepted by printers obtained from this factory.
- array of supported doc flavors
StreamPrintServicethat can print to the specified output stream. The output stream is created and managed by the application. It is the application's responsibility to close the stream and to ensure that this
Printeris not reused. The application should not close this stream until any print job created from the printer is complete. Doing so earlier may generate a
PrinterExceptionand an event indicating that the job failed.
PrintServiceconnected to a physical printer can be reused, a
StreamPrintServiceconnected to a stream cannot. The underlying
StreamPrintServicemay be disposed by the print system with the
disposemethod before returning from the
DocPrintJobso that the print system knows this printer is no longer usable. This is equivalent to a physical printer going offline - permanently. Applications may supply a
nullprint stream to create a queryable service. It is not valid to create a
PrintJobfor such a stream. Implementations which allocate resources on construction should examine the stream and may wish to only allocate resources if the stream is
out- destination stream for generated output
PrintServicewhich will generate the format specified by the
DocFlavorsupported by this factory