public abstract class AbstractWriter extends Object
Modifier and Type | Field and Description |
---|---|
protected static char |
NEWLINE
文本如何包模型的换行符。
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractWriter(Writer w, Document doc)
创建一个新的abstractwriter。
|
protected |
AbstractWriter(Writer w, Document doc, int pos, int len)
创建一个新的abstractwriter。
|
protected |
AbstractWriter(Writer w, Element root)
创建一个新的abstractwriter。
|
protected |
AbstractWriter(Writer w, Element root, int pos, int len)
创建一个新的abstractwriter。
|
Modifier and Type | Method and Description |
---|---|
protected void |
decrIndent()
减少缩进量。
|
protected boolean |
getCanWrapLines()
返回是否可以被包装的线条。
|
protected int |
getCurrentLineLength()
返回当前行的长度。
|
protected Document |
getDocument()
获取文件。
|
protected ElementIterator |
getElementIterator()
取elementiterator。
|
int |
getEndOffset()
返回输出的最后一个偏移量。
|
protected int |
getIndentLevel()
返回当前缩进级别。
|
protected int |
getIndentSpace()
返回空间量缩进。
|
protected int |
getLineLength()
返回最大行长度。
|
String |
getLineSeparator()
返回用于表示换行符的字符串。
|
int |
getStartOffset()
返回输出的第一个偏移量。
|
protected String |
getText(Element elem)
返回与元素关联的文本。
|
protected Writer |
getWriter()
返回用于输出内容的写者。
|
protected void |
incrIndent()
增加缩进量。
|
protected void |
indent()
没有压痕。
|
protected boolean |
inRange(Element next)
此方法确定当前元素是否在指定的范围内。
|
protected boolean |
isLineEmpty()
如果当前行应被认为是空的,则返回。
|
protected void |
output(char[] content, int start, int length)
写内容的最后一站。
|
protected void |
setCanWrapLines(boolean newValue)
设置是否可以包线。
|
protected void |
setCurrentLineLength(int length)
设置当前行的长度。
|
protected void |
setIndentSpace(int space)
让子类来指定多个空格缩进的Map。
|
protected void |
setLineLength(int l)
允许子类设置他们要每行写的字符数。
|
void |
setLineSeparator(String value)
设置用于表示换行符的字符串。
|
protected void |
text(Element elem)
写文本。
|
protected abstract void |
write()
这种抽象方法需要通过子类来实现。
|
protected void |
write(char ch)
写一个字符。
|
protected void |
write(char[] chars, int startIndex, int length)
所有写入方法都会调用这一个。
|
protected void |
write(String content)
写一个字符串。
|
protected void |
writeAttributes(AttributeSet attr)
将属性集写为“
<名称>
=
<值>
”对。
值>
名称>
|
protected void |
writeLineSeparator()
写入行分隔符。
|
protected AbstractWriter(Writer w, Document doc)
w
-作家。
doc
-文档
protected AbstractWriter(Writer w, Document doc, int pos, int len)
w
-作家
doc
-元素
pos
-在文档中的位置获取内容。
len
量-写出来。
protected AbstractWriter(Writer w, Element root)
w
-作家
root
-元素
public int getStartOffset()
public int getEndOffset()
protected ElementIterator getElementIterator()
protected Writer getWriter()
protected Document getDocument()
protected boolean inRange(Element next)
next
-元素。
protected abstract void write() throws IOException, BadLocationException
protected String getText(Element elem) throws BadLocationException
elem
-
Element
String
BadLocationException
如果POS代表文档中的一个无效的位置
protected void text(Element elem) throws BadLocationException, IOException
elem
-元素。
IOException
-
BadLocationException
如果POS代表文档中的一个无效的位置。
protected void setLineLength(int l)
l
-行的最大长度。
protected int getLineLength()
protected void setCurrentLineLength(int length)
protected int getCurrentLineLength()
protected boolean isLineEmpty()
getCurrentLineLength
= = 0 | |
indent
已被调用,在一个空的线。
protected void setCanWrapLines(boolean newValue)
protected boolean getCanWrapLines()
protected void setIndentSpace(int space)
space
代表空间缩进映射一个int。
protected int getIndentSpace()
public void setLineSeparator(String value)
public String getLineSeparator()
protected void incrIndent()
getIndentSpace()
*
getIndentLevel()
是>比
getLineLength()
这不会造成缩进。
protected void decrIndent()
protected int getIndentLevel()
incrIndent
数量已减倍
decrIndent
调用的数量已被调用。
protected void indent() throws IOException
IOException
-任何I/O错误
protected void write(char ch) throws IOException
write
方法采用一个字符[ ]。
ch
-一个字符。
IOException
-任何I/O错误
protected void write(String content) throws IOException
write
方法采用一个字符[ ]。
content
-一个字符串。
IOException
-任何I/O错误
protected void writeLineSeparator() throws IOException
output
直接调用以及设置
lineLength
0。
IOException
protected void write(char[] chars, int startIndex, int length) throws IOException
getCanWrapLines()
返回false,这将给
output
各
chars
不包含换行符序列,接着一个电话
writeLineSeparator
。另一方面,如果
getCanWrapLines()
返回true,这将拆分字符串,是必要的,所以
getLineLength
荣幸。唯一的例外是,如果当前字符串不包含空格,不适合在这种情况下,线路长度将超过
getLineLength
。
IOException
protected void writeAttributes(AttributeSet attr) throws IOException
attr
- attributeset。
IOException
-任何I/O错误
protected void output(char[] content, int start, int length) throws IOException
write
的作家。
这种方法也更新的基础上length
线长度。如果这是用来输出一个换行符,当前行的长度需要复位将不再有效。如果要打电话给打电话的人。使用writeLineSeparator
写出一个换行符,将属性更新当前行的长度。
IOException
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.