public class MinimalHTMLWriter extends AbstractWriter
<html>
<head>
<style>
<!-- list of named styles
p.normal {
font-family: SansSerif;
margin-height: 0;
font-size: 14
}
-->
</style>
</head>
<body>
<p style=normal>
Bold, italic, and underline attributes
of the run are emitted as HTML tags.
The remaining attributes are emitted as
part of the style attribute of a <span> tag.
The syntax is similar to inline styles.
</p>
</body>
</html>
NEWLINE| コンストラクタ | 説明 |
|---|---|
MinimalHTMLWriter(Writer w, StyledDocument doc) |
新しいMinimalHTMLWriterを作成します。
|
MinimalHTMLWriter(Writer w, StyledDocument doc, int pos, int len) |
新しいMinimalHTMLWriterを作成します。
|
| 修飾子と型 | メソッド | 説明 |
|---|---|---|
protected void |
endFontTag() |
現在使われていません。代わりに<span>が書き出されます。
|
protected boolean |
inFontTag() |
<font>タグ内ならtrueを返します。
|
protected boolean |
isText(Element elem) |
要素がテキストならtrueを返します。
|
protected void |
startFontTag(String style) |
現在使われていません。代わりに<span>が書き出されます。
|
protected void |
text(Element elem) |
テキストを書き出します。
|
void |
write() |
StyledDocumentからHTML出力を生成します。
|
protected void |
writeAttributes(AttributeSet attr) |
StyleConstants.ParagraphConstants、StyleConstants.CharacterConstants、StyleConstants.FontConstants、StyleConstants.ColorConstantsの各型のすべての属性を書き出します。
|
protected void |
writeBody() |
ドキュメント内の要素で反復し、枝の要素か葉の要素かを判断して要素を処理します。
|
protected void |
writeComponent(Element elem) |
コンポーネント要素の書出しを行います。意図的に実装しない場合があります。
|
protected void |
writeContent(Element elem, boolean needsIndenting) |
HTMLに準拠した方法で属性セットを書き出します。
|
protected void |
writeEndParagraph() |
<p>タグの終了タグを発行します。
|
protected void |
writeEndTag(String endTag) |
適切にインデント処理された終了タグを書き出します。
|
protected void |
writeHeader() |
<head>および<style>のタグを書出し、次にwriteStyles()を起動して<style>タグのコンテンツとしてすべての名前付き書式を書き出します。
|
protected void |
writeHTMLTags(AttributeSet attr) |
属性設定に基づいてテキストのボールド<b>、イタリック<i>、および<u>のタグを生成します。
|
protected void |
writeImage(Element elem) |
アイコン要素の書出しを行います。意図的に実装しない場合があります。
|
protected void |
writeLeaf(Element elem) |
テキスト以外の葉の要素の書出しを制御します。
|
protected void |
writeNonHTMLAttributes(AttributeSet attr) |
HTMLに準拠した方法で残りの文字レベルの属性(ボールド、イタリック、下線以外の属性)を書き出します。
|
protected void |
writeStartParagraph(Element elem) |
段落の開始タグを発行します。
|
protected void |
writeStartTag(String tag) |
適切にインデント処理された開始タグを書き出します。
|
protected void |
writeStyles() |
<style>タグのコンテンツとしてすべての名前付き書式を書き出します。
|
decrIndent, getCanWrapLines, getCurrentLineLength, getDocument, getElementIterator, getEndOffset, getIndentLevel, getIndentSpace, getLineLength, getLineSeparator, getStartOffset, getText, getWriter, incrIndent, indent, inRange, isLineEmpty, output, setCanWrapLines, setCurrentLineLength, setIndentSpace, setLineLength, setLineSeparator, write, write, write, writeLineSeparatorpublic MinimalHTMLWriter(Writer w, StyledDocument doc)
w - ライターdoc - StyledDocumentpublic MinimalHTMLWriter(Writer w, StyledDocument doc, int pos, int len)
w - ライターdoc - StyledDocumentpos - コンテンツを取得するドキュメント内の位置。len - 書き出す量。public void write()
throws IOException,
BadLocationException
write、クラスAbstractWriterIOException - 入出力エラーが発生した場合BadLocationException - posがドキュメント内の無効な位置を表す場合。protected void writeAttributes(AttributeSet attr) throws IOException
writeAttributes、クラスAbstractWriterattr - AttributeSet。IOException - 入出力エラーが発生した場合protected void text(Element elem) throws IOException, BadLocationException
text、クラスAbstractWriterelem - Element。IOException - 入出力エラーが発生した場合BadLocationException - posがドキュメント内の無効な位置を表す場合。protected void writeStartTag(String tag) throws IOException
IOException - 入出力エラーが発生した場合protected void writeEndTag(String endTag) throws IOException
IOException - 入出力エラーが発生した場合protected void writeHeader()
throws IOException
IOException - 入出力エラーが発生した場合protected void writeStyles()
throws IOException
IOException - 入出力エラーが発生した場合protected void writeBody()
throws IOException,
BadLocationException
IOException - 入出力エラーが発生した場合BadLocationExceptionprotected void writeEndParagraph()
throws IOException
IOException - 入出力エラーが発生した場合protected void writeStartParagraph(Element elem) throws IOException
IOException - 入出力エラーが発生した場合protected void writeLeaf(Element elem) throws IOException
IOException - 入出力エラーが発生した場合protected void writeImage(Element elem) throws IOException
elem - StyleConstants.IconElementName型の要素IOExceptionprotected void writeComponent(Element elem) throws IOException
IOExceptionprotected boolean isText(Element elem)
protected void writeContent(Element elem, boolean needsIndenting) throws IOException, BadLocationException
IOException - 入出力エラーが発生した場合BadLocationException - posがドキュメント内の無効な位置を表す場合。protected void writeHTMLTags(AttributeSet attr) throws IOException
IOException - 入出力エラーが発生した場合protected void writeNonHTMLAttributes(AttributeSet attr) throws IOException
IOException - 入出力エラーが発生した場合protected boolean inFontTag()
protected void endFontTag()
throws IOException
<font>タグ用の終了タグを書き出します。
IOException - 入出力エラーが発生した場合protected void startFontTag(String style) throws IOException
<font>タグ用の開始タグを書き出します。 フォント・タグは入れ子にできないため、新しい開始タグを書き出す前に、フォント・タグの囲みをクローズします。
IOException - 入出力エラーが発生した場合 バグまたは機能を送信
詳細なAPIリファレンスおよび開発者ドキュメントについては、Java SEのドキュメントを参照してください。 そのドキュメントには、概念的な概要、用語の定義、回避方法、有効なコード例などの、開発者を対象にしたより詳細な説明が含まれています。
Copyright © 1993, 2025, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Documentation Redistribution Policyも参照してください。