Doc
that can be used in
many common printing requests. It can handle all of the presently defined
"pre-defined" doc flavors defined as static variables in the
DocFlavor
class.
In particular this class implements certain required semantics of the
Doc
specification as follows:
Doc
MultiDoc
will not want to use this class.
If the print data is a stream, or a print job requests data as a stream, then
SimpleDoc
does not monitor if the service properly closes the stream
after data transfer completion or job termination. Clients may prefer to use
provide their own implementation of doc that adds a listener to monitor job
completion and to validate that resources such as streams are freed (ie
closed).
Modifier and Type | Field and Description |
---|---|
private DocAttributeSet | attributes
The set of printing attributes for this doc. |
private DocFlavor | flavor
The doc flavor in which this doc will supply its piece of print data. |
private InputStream | inStream
The input stream for extracting byte print data from this doc. |
private Object | printData
The print data. |
private Reader | reader
The reader for extracting character print data from this doc. |
Access | Constructor and Description |
---|---|
public | SimpleDoc(Object
the print data object printData, DocFlavor the flavor, DocAttributeSet DocFlavor objecta attributes)DocAttributeSet , which can be null Constructs a |
Modifier and Type | Method and Description |
---|---|
public DocAttributeSet | Returns: unmodifiable set of printing attributes for this doc, ornull to obtain all attribute values from the job's
attribute setImplements javax. |
public DocFlavor | Returns: doc flavorImplements javax. |
public Object | Returns: print data representation objectImplements javax. |
public Reader | Returns: aReader for reading the print data characters from this
doc. If a reader cannot be provided because this doc does not
meet the criteria stated above, null is returned.Implements javax. |
public InputStream | Returns: anInputStream for reading the print data bytes from this
doc. If an input stream cannot be provided because this doc does
not meet the criteria stated above, null is returned.Implements javax. |
attributes | back to summary |
---|---|
private DocAttributeSet attributes The set of printing attributes for this doc. |
flavor | back to summary |
---|---|
private DocFlavor flavor The doc flavor in which this doc will supply its piece of print data. |
inStream | back to summary |
---|---|
private InputStream inStream The input stream for extracting byte print data from this doc. |
printData | back to summary |
---|---|
private Object printData The print data. |
reader | back to summary |
---|---|
private Reader reader The reader for extracting character print data from this doc. |
SimpleDoc | back to summary |
---|---|
public SimpleDoc(Object printData, DocFlavor flavor, DocAttributeSet attributes) Constructs a
|
getAttributes | back to summary |
---|---|
public DocAttributeSet getAttributes() Implements javax. Obtains the set of printing attributes for this doc object. If the
returned attribute set includes an instance of a particular attribute
X, the printer must use that attribute value for this doc,
overriding any value of attribute X in the job's attribute set. If
the returned attribute set does not include an instance of a particular
attribute X or if
|
getDocFlavor | back to summary |
---|---|
public DocFlavor getDocFlavor() Implements javax. Determines the doc flavor in which this doc object will supply its piece of print data.
|
getPrintData | back to summary |
---|---|
public Object getPrintData() throws IOException Implements javax. Obtains the print data representation object that contains this doc
object's piece of print data in the format corresponding to the supported
doc flavor. The
|
getReaderForText | back to summary |
---|---|
public Reader getReaderForText() throws IOException Implements javax. Obtains a reader for extracting character print data from this doc. The
Reader for reading the print data as a stream of
characters from the print data representation object. However, if the
print data representation object is itself a Reader then the
print data representation object is simply returned.
|
getStreamForBytes | back to summary |
---|---|
public InputStream getStreamForBytes() throws IOException Implements javax. Obtains an input stream for extracting byte print data from this doc. The
|