📄 abstractwriter.html
字号:
<CODE>protected void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/text/AbstractWriter.html#setIndentSpace(int)">setIndentSpace</A></B>(int space)</CODE><BR> Enables subclasses to specify how many spaces an indent maps to.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/text/AbstractWriter.html#setLineLength(int)">setLineLength</A></B>(int l)</CODE><BR> Enables subclasses to set the number of characters they want written per line.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/text/AbstractWriter.html#setLineSeparator(java.lang.String)">setLineSeparator</A></B>(<A HREF="../../../java/lang/String.html">String</A> value)</CODE><BR> Sets the String used to reprsent newlines.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/text/AbstractWriter.html#text(javax.swing.text.Element)">text</A></B>(<A HREF="../../../javax/swing/text/Element.html">Element</A> elem)</CODE><BR> Writes out text.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected abstract void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/text/AbstractWriter.html#write()">write</A></B>()</CODE><BR> This abstract method needs to be implemented by subclasses.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/text/AbstractWriter.html#write(char)">write</A></B>(char ch)</CODE><BR> Writes out a character.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/text/AbstractWriter.html#write(char[], int, int)">write</A></B>(char[] chars, int startIndex, int length)</CODE><BR> All write methods call into this one.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/text/AbstractWriter.html#write(java.lang.String)">write</A></B>(<A HREF="../../../java/lang/String.html">String</A> content)</CODE><BR> Writes out a string.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/text/AbstractWriter.html#writeAttributes(javax.swing.text.AttributeSet)">writeAttributes</A></B>(<A HREF="../../../javax/swing/text/AttributeSet.html">AttributeSet</A> attr)</CODE><BR> Writes out the set of attributes as " <name>=<value>" pairs.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/text/AbstractWriter.html#writeLineSeparator()">writeLineSeparator</A></B>()</CODE><BR> Writes the line separator.</TD></TR></TABLE> <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from class java.lang.<A HREF="../../../java/lang/Object.html">Object</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../../java/lang/Object.html#clone()">clone</A>, <A HREF="../../../java/lang/Object.html#equals(java.lang.Object)">equals</A>, <A HREF="../../../java/lang/Object.html#finalize()">finalize</A>, <A HREF="../../../java/lang/Object.html#getClass()">getClass</A>, <A HREF="../../../java/lang/Object.html#hashCode()">hashCode</A>, <A HREF="../../../java/lang/Object.html#notify()">notify</A>, <A HREF="../../../java/lang/Object.html#notifyAll()">notifyAll</A>, <A HREF="../../../java/lang/Object.html#toString()">toString</A>, <A HREF="../../../java/lang/Object.html#wait()">wait</A>, <A HREF="../../../java/lang/Object.html#wait(long)">wait</A>, <A HREF="../../../java/lang/Object.html#wait(long, int)">wait</A></CODE></TD></TR></TABLE> <P><!-- ============ FIELD DETAIL =========== --><A NAME="field_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Field Detail</B></FONT></TD></TR></TABLE><A NAME="NEWLINE"><!-- --></A><H3>NEWLINE</H3><PRE>protected static final char <B>NEWLINE</B></PRE><DL><DD>How the text packages models newlines.<DD><DL><DT><B>See Also: </B><DD><A HREF="../../../javax/swing/text/AbstractWriter.html#getLineSeparator()"><CODE>getLineSeparator()</CODE></A></DL></DD></DL><!-- ========= CONSTRUCTOR DETAIL ======== --><A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Constructor Detail</B></FONT></TD></TR></TABLE><A NAME="AbstractWriter(java.io.Writer, javax.swing.text.Document)"><!-- --></A><H3>AbstractWriter</H3><PRE>protected <B>AbstractWriter</B>(<A HREF="../../../java/io/Writer.html">Writer</A> w, <A HREF="../../../javax/swing/text/Document.html">Document</A> doc)</PRE><DL><DD>Creates a new AbstractWriter. Initializes the ElementIterator with the default root of the document.<DD><DL><DT><B>Parameters:</B><DD><CODE>a</CODE> - Writer.<DD><CODE>a</CODE> - Document</DL></DD></DL><HR><A NAME="AbstractWriter(java.io.Writer, javax.swing.text.Document, int, int)"><!-- --></A><H3>AbstractWriter</H3><PRE>protected <B>AbstractWriter</B>(<A HREF="../../../java/io/Writer.html">Writer</A> w, <A HREF="../../../javax/swing/text/Document.html">Document</A> doc, int pos, int len)</PRE><DL><DD>Creates a new AbstractWriter. Initializes the ElementIterator with the element passed in.<DD><DL><DT><B>Parameters:</B><DD><CODE>a</CODE> - Writer<DD><CODE>an</CODE> - Element<DD><CODE>pos</CODE> - The location in the document to fetch the content.<DD><CODE>len</CODE> - The amount to write out.</DL></DD></DL><HR><A NAME="AbstractWriter(java.io.Writer, javax.swing.text.Element)"><!-- --></A><H3>AbstractWriter</H3><PRE>protected <B>AbstractWriter</B>(<A HREF="../../../java/io/Writer.html">Writer</A> w, <A HREF="../../../javax/swing/text/Element.html">Element</A> root)</PRE><DL><DD>Creates a new AbstractWriter. Initializes the ElementIterator with the element passed in.<DD><DL><DT><B>Parameters:</B><DD><CODE>a</CODE> - Writer<DD><CODE>an</CODE> - Element</DL></DD></DL><HR><A NAME="AbstractWriter(java.io.Writer, javax.swing.text.Element, int, int)"><!-- --></A><H3>AbstractWriter</H3><PRE>protected <B>AbstractWriter</B>(<A HREF="../../../java/io/Writer.html">Writer</A> w, <A HREF="../../../javax/swing/text/Element.html">Element</A> root, int pos, int len)</PRE><DL><DD>Creates a new AbstractWriter. Initializes the ElementIterator with the element passed in.<DD><DL><DT><B>Parameters:</B><DD><CODE>a</CODE> - Writer<DD><CODE>an</CODE> - Element<DD><CODE>pos</CODE> - The location in the document to fetch the content.<DD><CODE>len</CODE> - The amount to write out.</DL></DD></DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="getStartOffset()"><!-- --></A><H3>getStartOffset</H3><PRE>public int <B>getStartOffset</B>()</PRE><DL><DD>Returns the first offset to be output.<DD><DL><DT><B>Since: </B><DD>1.3</DD></DL></DD></DL><HR><A NAME="getEndOffset()"><!-- --></A><H3>getEndOffset</H3><PRE>public int <B>getEndOffset</B>()</PRE><DL><DD>Returns the last offset to be output.<DD><DL><DT><B>Since: </B><DD>1.3</DD></DL></DD></DL><HR><A NAME="getElementIterator()"><!-- --></A><H3>getElementIterator</H3><PRE>protected <A HREF="../../../javax/swing/text/ElementIterator.html">ElementIterator</A> <B>getElementIterator</B>()</PRE><DL><DD>Fetches the ElementIterator.<DD><DL><DT><B>Returns:</B><DD>the ElementIterator.</DL></DD></DL><HR><A NAME="getWriter()"><!-- --></A><H3>getWriter</H3><PRE>protected <A HREF="../../../java/io/Writer.html">Writer</A> <B>getWriter</B>()</PRE><DL><DD>Returns the Writer that is used to output the content.<DD><DL><DT><B>Since: </B><DD>1.3</DD></DL></DD></DL><HR><A NAME="getDocument()"><!-- --></A><H3>getDocument</H3><PRE>protected <A HREF="../../../javax/swing/text/Document.html">Document</A> <B>getDocument</B>()</PRE><DL><DD>Fetches the document.<DD><DL><DT><B>Returns:</B><DD>the Document.</DL></DD></DL><HR><A NAME="inRange(javax.swing.text.Element)"><!-- --></A><H3>inRange</H3><PRE>protected boolean <B>inRange</B>(<A HREF="../../../javax/swing/text/Element.html">Element</A> next)</PRE><DL><DD>This method determines whether the current element is in the range specified. When no range is specified, the range is initialized to be the entire document. inRange() returns true if the range specified intersects with the element's range.<DD><DL><DT><B>Parameters:</B><DD><CODE>an</CODE> - Element.<DT><B>Returns:</B><DD>boolean that indicates whether the element is in the range.</DL></DD></DL><HR><A NAME="write()"><!-- --></A><H3>write</H3><PRE>protected abstract void <B>write</B>() throws <A HREF="../../../java/io/IOException.html">IOException</A>, <A HREF="../../../javax/swing/text/BadLocationException.html">BadLocationException</A></PRE><DL><DD>This abstract method needs to be implemented by subclasses. Its responsibility is to iterate over the elements and use the write() methods to generate output in the desired format.</DL><HR><A NAME="getText(javax.swing.text.Element)"><!-- --></A><H3>getText</H3><PRE>protected <A HREF="../../../java/lang/String.html">String</A> <B>getText</B>(<A HREF="../../../javax/swing/text/Element.html">Element</A> elem) throws <A HREF="../../../javax/swing/text/BadLocationException.html">BadLocationException</A></PRE><DL><DD>Returns the text associated with the element. The assumption here is that the element is a leaf element. Throws a BadLocationException when encountered.<DD><DL><DT><B>Parameters:</B><DD><CODE>an</CODE> - Element.<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/swing/text/BadLocationException.html">BadLocationException</A></CODE> - if pos represents an invalid location within the document.</DL></DD></DL><HR><A NAME="text(javax.swing.text.Element)"><!-- --></A><H3>text</H3><PRE>protected void <B>text</B>(<A HREF="../../../javax/swing/text/Element.html">Element</A> elem) throws <A HREF="../../../javax/swing/text/BadLocationException.html">BadLocationException</A>, <A HREF="../../../java/io/IOException.html">IOException</A></PRE><DL><DD>Writes out text. If a range is specified when the constructor is invoked, then only the appropriate range of text is written out.<DD><DL><DT><B>Parameters:</B><DD><CODE>an</CODE> - Element.<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/io/IOException.html">IOException</A></CODE> - on any I/O error<DD><CODE><A HREF="../../../javax/swing/text/BadLocationException.html">BadLocationException</A></CODE> - if pos represents an invalid location within the document.</DL></DD></DL><HR><A NAME="setLineLength(int)"><!-- --></A><H3>setLineLength</H3><PRE>protected void <B>setLineLength</B>(int l)</PRE><DL><DD>Enables subclasses to set the number of characters they want written per line. The default is 100.<DD><DL><DT><B>Parameters:</B><DD><CODE>the</CODE> - maximum line length.</DL></DD>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -