|
JavaTM 2 Platform Std. Ed. v1.3 |
|||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 内部クラス | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
java.lang.Object | +--javax.swing.text.AbstractWriter
AbstractWriter は、属性を含む要素ツリーを実際に書き出す抽象クラスです。1 行あたりに書き出す文字数のデフォルトは 100 です。ただし、この値はサブクラスで設定することができます。
フィールドの概要 | |
protected static char |
NEWLINE
テキストパッケージモデルの改行法 |
コンストラクタの概要 | |
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 void |
decrIndent()
インデントレベルをデクリメントします。 |
protected boolean |
getCanWrapLines()
行がラップ可能かどうかを返します。 |
protected int |
getCurrentLineLength()
現在の行の長さを返します。 |
protected Document |
getDocument()
Document を取り出します。 |
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()
現在の行の長さが空の場合は、true を返します。 |
protected void |
output(char[] content,
int start,
int length)
コンテンツ書き込み時の最後の停止です。 |
protected void |
setCanWrapLines(boolean newValue)
行をラップできるかどうかを設定します。 |
protected void |
setCurrentLineLength(int length)
現在の行の長さを設定します。 |
protected void |
setIndentSpace(int space)
インデントにマッピングするスペースの数をサブクラスから指定できるようにします。 |
protected void |
setLineLength(int l)
1 行あたりに書き込むことのできる文字数をサブクラスから設定できるようにします。 |
void |
setLineSeparator(String value)
改行を表すときに使用する String を設定します。 |
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()
行区切り文字を書き出します。 |
クラス java.lang.Object から継承したメソッド |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
フィールドの詳細 |
protected static final char NEWLINE
getLineSeparator()
コンストラクタの詳細 |
protected AbstractWriter(Writer w, Document doc)
a
- ライターa
- ドキュメントprotected AbstractWriter(Writer w, Document doc, int pos, int len)
a
- ライターan
- 要素pos
- コンテンツを取得するドキュメント内の位置len
- 書き出す量protected AbstractWriter(Writer w, Element root)
a
- ライターan
- 要素protected AbstractWriter(Writer w, Element root, int pos, int len)
a
- ライターan
- 要素pos
- コンテンツを取得するドキュメント内の位置len
- 書き出す量メソッドの詳細 |
public int getStartOffset()
public int getEndOffset()
protected ElementIterator getElementIterator()
protected Writer getWriter()
protected Document getDocument()
protected boolean inRange(Element next)
an
- 要素protected abstract void write() throws IOException, BadLocationException
protected String getText(Element elem) throws BadLocationException
an
- 要素BadLocationException
- pos がドキュメント内の無効な位置を示す場合protected void text(Element elem) throws BadLocationException, IOException
an
- 要素IOException
- 入出力エラーが発生した場合BadLocationException
- pos がドキュメント内の無効な位置を示す場合protected void setLineLength(int l)
the
- 行の長さの最大値protected int getLineLength()
protected void setCurrentLineLength(int length)
protected int getCurrentLineLength()
protected boolean isLineEmpty()
getCurrentLineLength
== 0 || indent
が空の行上で呼び出された場合には true です。protected void setCanWrapLines(boolean newValue)
protected boolean getCanWrapLines()
protected void setIndentSpace(int space)
an
- インデントにマッピングするスペースを表す int 値protected int getIndentSpace()
public void setLineSeparator(String value)
public String getLineSeparator()
protected void incrIndent()
getLineLength()
よりも大きくなるような getIndentSpace()
* getIndentLevel()
となるとインデントしません。protected void decrIndent()
protected int getIndentLevel()
incrIndent
が呼び出された回数から decrIndent
が呼び出された回数を引いた数です。protected void indent() throws IOException
IOException
- 入出力エラーが発生した場合protected void write(char ch) throws IOException
write
メソッドを呼び出すときに実装されます。a
- charIOException
- 入出力エラーが発生した場合protected void write(String content) throws IOException
write
メソッドを呼び出すときに実装されます。a
- 文字列IOException
- 入出力エラーが発生した場合protected void writeLineSeparator() throws IOException
output
を直接呼び出して、lineLength
を 0 に設定します。protected void write(char[] chars, int startIndex, int length) throws IOException
getCanWrapLines()
が false を返すと NEWLINE を含まない chars
の各シーケンス付き output
を呼び出し、続いて writeLineSeparator
を呼び出します。一方、getCanWrapLines()
が true を返すと、必要に応じて文字列を分割して getLineLength
を受け取ります。唯一の例外は現在の文字列に空白が含まれない場合で、行の長さが getLineLength
を超えるため収まりません。protected void writeAttributes(AttributeSet attr) throws IOException
an
- AttributeSetIOException
- 入出力エラーが発生した場合protected void output(char[] content, int start, int length) throws IOException
write
を呼び出します。
このメソッドも length
に基づき行の長さを更新します。改行を出力するために呼び出されると、現在の行の長さをリセットして無効にする必要があります。この実行が呼び出し側に依存する場合は、writeLineSeparator
を使用して改行を書き出し、現在の行の長さのプロパティを更新します。
|
JavaTM 2 Platform Std. Ed. v1.3 |
|||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 内部クラス | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
Java、Java 2D、JDBC は、米国およびその他の国における米国 Sun Microsystems, Inc. の商標もしくは登録商標です。
Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.