📄 abstractwriter.html
字号:
</DL><HR><A NAME="getLineLength()"><!-- --></A><H3>getLineLength</H3><PRE>protected int <B>getLineLength</B>()</PRE><DL><DD>Returns the maximum line length.<DD><DL><DT><B>Since: </B><DD>1.3</DD></DL></DD></DL><HR><A NAME="setCurrentLineLength(int)"><!-- --></A><H3>setCurrentLineLength</H3><PRE>protected void <B>setCurrentLineLength</B>(int length)</PRE><DL><DD>Sets the current line length.<DD><DL><DT><B>Since: </B><DD>1.3.</DD></DL></DD></DL><HR><A NAME="getCurrentLineLength()"><!-- --></A><H3>getCurrentLineLength</H3><PRE>protected int <B>getCurrentLineLength</B>()</PRE><DL><DD>Returns the current line length.<DD><DL><DT><B>Since: </B><DD>1.3.</DD></DL></DD></DL><HR><A NAME="isLineEmpty()"><!-- --></A><H3>isLineEmpty</H3><PRE>protected boolean <B>isLineEmpty</B>()</PRE><DL><DD>Returns true if the current line should be considered empty. This is true when <code>getCurrentLineLength</code> == 0 || <code>indent</code> has been invoked on an empty line.<DD><DL><DT><B>Since: </B><DD>1.3</DD></DL></DD></DL><HR><A NAME="setCanWrapLines(boolean)"><!-- --></A><H3>setCanWrapLines</H3><PRE>protected void <B>setCanWrapLines</B>(boolean newValue)</PRE><DL><DD>Sets whether or not lines can be wrapped. This can be toggled during the writing of lines. For example, outputting HTML might set this to false when outputting a quoted string.<DD><DL><DT><B>Since: </B><DD>1.3</DD></DL></DD></DL><HR><A NAME="getCanWrapLines()"><!-- --></A><H3>getCanWrapLines</H3><PRE>protected boolean <B>getCanWrapLines</B>()</PRE><DL><DD>Returns whether or not the lines can be wrapped. If this is false no lineSeparator's will be output.<DD><DL><DT><B>Since: </B><DD>1.3</DD></DL></DD></DL><HR><A NAME="setIndentSpace(int)"><!-- --></A><H3>setIndentSpace</H3><PRE>protected void <B>setIndentSpace</B>(int space)</PRE><DL><DD>Enables subclasses to specify how many spaces an indent maps to. When indentation takes place, the indent level is multiplied by this mapping. The default is 2.<DD><DL><DT><B>Parameters:</B><DD><CODE>an</CODE> - int representing the space to indent mapping.</DL></DD></DL><HR><A NAME="getIndentSpace()"><!-- --></A><H3>getIndentSpace</H3><PRE>protected int <B>getIndentSpace</B>()</PRE><DL><DD>Returns the amount of space to indent.<DD><DL><DT><B>Since: </B><DD>1.3</DD></DL></DD></DL><HR><A NAME="setLineSeparator(java.lang.String)"><!-- --></A><H3>setLineSeparator</H3><PRE>public void <B>setLineSeparator</B>(<A HREF="../../../java/lang/String.html">String</A> value)</PRE><DL><DD>Sets the String used to reprsent newlines. This is initialized in the constructor from either the Document, or the System property line.separator.<DD><DL><DT><B>Since: </B><DD>1.3</DD></DL></DD></DL><HR><A NAME="getLineSeparator()"><!-- --></A><H3>getLineSeparator</H3><PRE>public <A HREF="../../../java/lang/String.html">String</A> <B>getLineSeparator</B>()</PRE><DL><DD>Returns the string used to represent newlines.<DD><DL><DT><B>Since: </B><DD>1.3</DD></DL></DD></DL><HR><A NAME="incrIndent()"><!-- --></A><H3>incrIndent</H3><PRE>protected void <B>incrIndent</B>()</PRE><DL><DD>Increments the indent level. If indenting would cause <code>getIndentSpace()</code> *<code>getIndentLevel()</code> to be > than <code>getLineLength()</code> this will not cause an indent.</DL><HR><A NAME="decrIndent()"><!-- --></A><H3>decrIndent</H3><PRE>protected void <B>decrIndent</B>()</PRE><DL><DD>Decrements the indent level.</DL><HR><A NAME="getIndentLevel()"><!-- --></A><H3>getIndentLevel</H3><PRE>protected int <B>getIndentLevel</B>()</PRE><DL><DD>Returns the current indentation level. That is, the number of times <code>incrIndent</code> has been invoked minus the number of times <code>decrIndent</code> has been invoked.<DD><DL><DT><B>Since: </B><DD>1.3</DD></DL></DD></DL><HR><A NAME="indent()"><!-- --></A><H3>indent</H3><PRE>protected void <B>indent</B>() throws <A HREF="../../../java/io/IOException.html">IOException</A></PRE><DL><DD>Does indentation. The number of spaces written out is indent level times the space to map mapping. If the current line is empty, this will not make it so that the current line is still considered empty.<DD><DL><DT><B>Throws:</B><DD><CODE><A HREF="../../../java/io/IOException.html">IOException</A></CODE> - on any I/O error</DL></DD></DL><HR><A NAME="write(char)"><!-- --></A><H3>write</H3><PRE>protected void <B>write</B>(char ch) throws <A HREF="../../../java/io/IOException.html">IOException</A></PRE><DL><DD>Writes out a character. This is implemented to invoke the <code>write</code> method that takes a char[].<DD><DL><DT><B>Parameters:</B><DD><CODE>a</CODE> - char.<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/io/IOException.html">IOException</A></CODE> - on any I/O error</DL></DD></DL><HR><A NAME="write(java.lang.String)"><!-- --></A><H3>write</H3><PRE>protected void <B>write</B>(<A HREF="../../../java/lang/String.html">String</A> content) throws <A HREF="../../../java/io/IOException.html">IOException</A></PRE><DL><DD>Writes out a string. This is implemented to invoke the <code>write</code> method that takes a char[].<DD><DL><DT><B>Parameters:</B><DD><CODE>a</CODE> - String.<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/io/IOException.html">IOException</A></CODE> - on any I/O error</DL></DD></DL><HR><A NAME="writeLineSeparator()"><!-- --></A><H3>writeLineSeparator</H3><PRE>protected void <B>writeLineSeparator</B>() throws <A HREF="../../../java/io/IOException.html">IOException</A></PRE><DL><DD>Writes the line separator. This invokes <code>output</code> directly as well as setting the <code>lineLength</code> to 0.<DD><DL><DT><B>Since: </B><DD>1.3</DD></DL></DD></DL><HR><A NAME="write(char[], int, int)"><!-- --></A><H3>write</H3><PRE>protected void <B>write</B>(char[] chars, int startIndex, int length) throws <A HREF="../../../java/io/IOException.html">IOException</A></PRE><DL><DD>All write methods call into this one. If <code>getCanWrapLines()</code> returns false, this will call <code>output</code> with each sequence of <code>chars</code> that doesn't contain a NEWLINE, followed by a call to <code>writeLineSeparator</code>. On the other hand, if <code>getCanWrapLines()</code> returns true, this will split the string, as necessary, so <code>getLineLength</code> is honored. The only exception is if the current string contains no whitespace, and won't fit in which case the line length will exceed <code>getLineLength</code>.<DD><DL><DT><B>Since: </B><DD>1.3</DD></DL></DD></DL><HR><A NAME="writeAttributes(javax.swing.text.AttributeSet)"><!-- --></A><H3>writeAttributes</H3><PRE>protected void <B>writeAttributes</B>(<A HREF="../../../javax/swing/text/AttributeSet.html">AttributeSet</A> attr) throws <A HREF="../../../java/io/IOException.html">IOException</A></PRE><DL><DD>Writes out the set of attributes as " <name>=<value>" pairs. It throws an IOException when encountered.<DD><DL><DT><B>Parameters:</B><DD><CODE>an</CODE> - AttributeSet.<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/io/IOException.html">IOException</A></CODE> - on any I/O error</DL></DD></DL><HR><A NAME="output(char[], int, int)"><!-- --></A><H3>output</H3><PRE>protected void <B>output</B>(char[] content, int start, int length) throws <A HREF="../../../java/io/IOException.html">IOException</A></PRE><DL><DD>The last stop in writing out content. All the write methods eventually make it to this method, which invokes <code>write</code> on the Writer. <p>This method also updates the line length based on <code>length</code>. If this is invoked to output a newline, the current line length will need to be reset as will no longer be valid. If it is up to the caller to do this. Use <code>writeLineSeparator</code> to write out a newline, which will property update the current line length.<DD><DL><DT><B>Since: </B><DD>1.3</DD></DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_bottom"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/AbstractWriter.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Std. Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../javax/swing/text/AbstractDocument.LeafElement.html"><B>PREV CLASS</B></A> <A HREF="../../../javax/swing/text/AsyncBoxView.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="AbstractWriter.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><font size="-1"><a href="http://java.sun.com/cgi-bin/bugreport.cgi">Submit a bug or feature</a><br>For further API reference and developer documentation, see <a href="http://java.sun.com/products/jdk/1.3/devdocs-vs-specs.html">Java 2 SDK SE Developer Documentation</a>. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. <p>Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.<br>Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road<br>Palo Alto, California, 94303, U.S.A. All Rights Reserved.</font></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -