所有类


javax.swing.text
类 AbstractWriter

java.lang.Object
  继承者 javax.swing.text.AbstractWriter
直接已知子类:
HTMLWriter, MinimalHTMLWriter

public abstract class AbstractWriter
   
   
   
   
extends Object

AbstractWriter 是一个抽象类,它实际执行元素树(包括属性)的写出工作。在每行写出的元素数方面,writer 默认值是 100。但是子类可设置此值。


字段摘要
protected static charNEWLINE
          text 包模拟新行的方式。
 
构造方法摘要
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。
 
方法摘要
protected  voiddecrIndent()
          降低缩进级别。
protected  booleangetCanWrapLines()
          返回是否可以换行。
protected  intgetCurrentLineLength()
          返回当前行的长度。
protected  DocumentgetDocument()
          获取文档。
protected  ElementIteratorgetElementIterator()
          获取 ElementIterator。
 intgetEndOffset()
          选择要输出内容的最后一个偏移量。
protected  intgetIndentLevel()
          返回当前的缩进级别。
protected  intgetIndentSpace()
          返回要缩进的空格量。
protected  intgetLineLength()
          返回最大行长度。
 StringgetLineSeparator()
          返回用于表示换行的 String。
 intgetStartOffset()
          返回要输出内容的第一个偏移量。
protected  StringgetText(Element elem)
          返回与该元素关联的文本。
protected  WritergetWriter()
          返回用于输出内容的 Writer。
protected  voidincrIndent()
          提高缩进级别。
protected  voidindent()
          执行缩进。
protected  booleaninRange(Element next)
          此方法确定当前元素是否位于指定的范围内。
protected  booleanisLineEmpty()
          如果应该将当前行视为空行,则返回 true。
protected  voidoutput(char[] content, int start, int length)
          写出内容过程的最后一步。
protected  voidsetCanWrapLines(boolean newValue)
          设置是否可以换行。
protected  voidsetCurrentLineLength(int length)
          设置当前行的长度。
protected  voidsetIndentSpace(int space)
          允许子类指定缩进映射为多少空格。
protected  voidsetLineLength(int l)
          允许子类设置每行上要写入的字符数。
 voidsetLineSeparator(String value)
          设置用于表示换行的 String。
protected  voidtext(Element elem)
          写出文本。
protected abstract  voidwrite()
          需要由子类实现此抽象方法。
protected  voidwrite(char ch)
          写出字符。
protected  voidwrite(char[] chars, int startIndex, int length)
          所有 write 方法都调用到此方法。
protected  voidwrite(String content)
          写出字符串。
protected  voidwriteAttributes(AttributeSet attr)
          以 " = " 对的形式写出属性集。
protected  voidwriteLineSeparator()
          写入行分隔符。
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

NEWLINE

protected static final char NEWLINE
text 包模拟新行的方式。

另请参见:
getLineSeparator(), 常量字段值
构造方法详细信息

AbstractWriter

protected AbstractWriter(Writer w,
                         Document doc)
创建新的 AbstractWriter。使用默认的文档根初始化 ElementIterator。

参数:
w - Writer。
document - Document。

AbstractWriter

protected AbstractWriter(Writer w,
                         Document doc,
                         int pos,
                         int len)
创建新的 AbstractWriter。使用传入的元素初始化 ElementIterator。

参数:
w - Writer
doc - Element
pos - 在文档中获取内容的位置。
len - 写出量。

AbstractWriter

protected AbstractWriter(Writer w,
                         Element root)
创建新的 AbstractWriter。使用传入的元素初始化 ElementIterator。

参数:
w - Writer
root - Element

AbstractWriter

protected AbstractWriter(Writer w,
                         Element root,
                         int pos,
                         int len)
创建新的 AbstractWriter。使用传入的元素初始化 ElementIterator。

参数:
w - Writer
root - Element
pos - 在文档中获取内容的位置。
len - 写出量。
方法详细信息

getStartOffset

public int getStartOffset()
返回要输出内容的第一个偏移量。

从以下版本开始:
1.3

getEndOffset

public int getEndOffset()
选择要输出内容的最后一个偏移量。

从以下版本开始:
1.3

getElementIterator

protected ElementIterator getElementIterator()
获取 ElementIterator。

返回:
ElementIterator。

getWriter

protected Writer getWriter()
返回用于输出内容的 Writer。

从以下版本开始:
1.3