public final class SimpleDoc extends Object implements Doc
Doc可用于许多常见的印刷要求。它可以处理所有当前定义的“定义”定义为在docflavor DOC香料类的静态变量。
特别是这个类实现了某些所需的语义的文件规范如下:
如果打印数据流,或打印作业请求的数据流,然后SimpleDoc不会监控,如果服务正常关闭流数据传输完成或工作结束后。客户端可能更喜欢使用提供自己的实现的文件,增加了一个侦听器来监视作业完成,并验证这些资源,如流被释放(即关闭)。
| Constructor and Description |
|---|
SimpleDoc(Object printData, DocFlavor flavor, DocAttributeSet attributes)
构建一个与指定的打印数据
SimpleDoc,DOC的风味和文件属性设置。
|
| Modifier and Type | Method and Description |
|---|---|
DocAttributeSet |
getAttributes()
获取此文档对象的打印属性集。
|
DocFlavor |
getDocFlavor()
确定此文档对象将提供其打印数据的文档的味道。
|
Object |
getPrintData()
获取包含此文档对象的打印数据的打印数据表示对象,该对象的打印数据对应于支持的文档味道的格式。
|
Reader |
getReaderForText()
获取一个用于从该文档中提取字符打印数据的读写器。
|
InputStream |
getStreamForBytes()
获取一个用于从该文档中提取字节打印数据的输入流。
|
public SimpleDoc(Object printData, DocFlavor flavor, DocAttributeSet attributes)
SimpleDoc与指定的打印数据,DOC的风味和文件属性设置。
printData -打印数据对象
flavor -
DocFlavor对象
attributes -
DocAttributeSet,可
null
IllegalArgumentException -如果
flavor或
printData是
null,或
printData不符合指定的医生的味道--例如,数据没有被指定在
DocFlavor表示式。
public DocFlavor getDocFlavor()
getDocFlavor 接口
Doc
public DocAttributeSet getAttributes()
getAttributes 接口
Doc
public Object getPrintData() throws IOException
Doc
getPrintData()表示类的名称是由
getDocFlavor().getRepresentationClassName()实例,并返回值可以转换从类对象类,表示。
getPrintData 接口
Doc
IOException如果表示的类是一个流有I/O错误而构建流扔。
public Reader getReaderForText() throws IOException
Doc实现来支持此方法如果
DocFlavor具有下面的打印数据表示的类,并返回
null否则:
char[]java.lang.Stringjava.io.ReaderReader。然而,如果打印数据表示对象本身是一个
Reader然后打印数据表示的对象只是返回。
getReaderForText 接口
Doc
Reader。如果读者不能提供这个文件因为不符合以上标准,
null返回。
IOException -如果有一个I/O错误而创造读者。
public InputStream getStreamForBytes() throws IOException
Doc实现来支持此方法如果
DocFlavor具有下面的打印数据表示的类;否则,该方法返回
null:获得
byte[]java.io.InputStreamgetStreamForBytes 接口
Doc
InputStream打印数据。如果一个输入流无法提供因为这文件不符合以上标准,
null返回。
IOException -如果有一个I/O错误而创建的输入流。
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.