📄 stringbuffer.html
字号:
<CODE> <A HREF="../../java/lang/StringBuffer.html">StringBuffer</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/lang/StringBuffer.html#deleteCharAt(int)">deleteCharAt</A></B>(int index)</CODE>
<BR>
Removes the character at the specified position in this <code>StringBuffer</code> (shortening the <code>StringBuffer</code> by one character).</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="../../java/lang/StringBuffer.html#ensureCapacity(int)">ensureCapacity</A></B>(int minimumCapacity)</CODE>
<BR>
Ensures that the capacity of the buffer is at least equal to the specified minimum.</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="../../java/lang/StringBuffer.html#getChars(int, int, char[], int)">getChars</A></B>(int srcBegin, int srcEnd, char[] dst, int dstBegin)</CODE>
<BR>
Characters are copied from this string buffer into the destination character array <code>dst</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../java/lang/StringBuffer.html">StringBuffer</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/lang/StringBuffer.html#insert(int, boolean)">insert</A></B>(int offset, boolean b)</CODE>
<BR>
Inserts the string representation of the <code>boolean</code> argument into this string buffer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../java/lang/StringBuffer.html">StringBuffer</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/lang/StringBuffer.html#insert(int, char)">insert</A></B>(int offset, char c)</CODE>
<BR>
Inserts the string representation of the <code>char</code> argument into this string buffer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../java/lang/StringBuffer.html">StringBuffer</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/lang/StringBuffer.html#insert(int, char[])">insert</A></B>(int offset, char[] str)</CODE>
<BR>
Inserts the string representation of the <code>char</code> array argument into this string buffer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../java/lang/StringBuffer.html">StringBuffer</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/lang/StringBuffer.html#insert(int, int)">insert</A></B>(int offset, int i)</CODE>
<BR>
Inserts the string representation of the second <code>int</code> argument into this string buffer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../java/lang/StringBuffer.html">StringBuffer</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/lang/StringBuffer.html#insert(int, long)">insert</A></B>(int offset, long l)</CODE>
<BR>
Inserts the string representation of the <code>long</code> argument into this string buffer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../java/lang/StringBuffer.html">StringBuffer</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/lang/StringBuffer.html#insert(int, java.lang.Object)">insert</A></B>(int offset, <A HREF="../../java/lang/Object.html">Object</A> obj)</CODE>
<BR>
Inserts the string representation of the <code>Object</code> argument into this string buffer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../java/lang/StringBuffer.html">StringBuffer</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/lang/StringBuffer.html#insert(int, java.lang.String)">insert</A></B>(int offset, <A HREF="../../java/lang/String.html">String</A> str)</CODE>
<BR>
Inserts the string into this string buffer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/lang/StringBuffer.html#length()">length</A></B>()</CODE>
<BR>
Returns the length (character count) of this string buffer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../java/lang/StringBuffer.html">StringBuffer</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/lang/StringBuffer.html#reverse()">reverse</A></B>()</CODE>
<BR>
The character sequence contained in this string buffer is replaced by the reverse of the sequence.</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="../../java/lang/StringBuffer.html#setCharAt(int, char)">setCharAt</A></B>(int index, char ch)</CODE>
<BR>
The character at the specified index of this string buffer is set to <code>ch</code>.</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="../../java/lang/StringBuffer.html#setLength(int)">setLength</A></B>(int newLength)</CODE>
<BR>
Sets the length of this String buffer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/lang/StringBuffer.html#toString()">toString</A></B>()</CODE>
<BR>
Converts to a string representing the data in this string buffer.</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#equals(java.lang.Object)">equals</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#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 =========== -->
<!-- ========= 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="StringBuffer()"><!-- --></A><H3>
StringBuffer</H3>
<PRE>
public <B>StringBuffer</B>()</PRE>
<DL>
<DD>Constructs a string buffer with no characters in it and an initial capacity of 16 characters.</DL>
<HR>
<A NAME="StringBuffer(int)"><!-- --></A><H3>
StringBuffer</H3>
<PRE>
public <B>StringBuffer</B>(int length)</PRE>
<DL>
<DD>Constructs a string buffer with no characters in it and an initial capacity specified by the <code>length</code> argument.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>length</CODE> - the initial capacity.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/NegativeArraySizeException.html">NegativeArraySizeException</A></CODE> - if the <code>length</code> argument is less than <code>0</code>.</DL>
</DD>
</DL>
<HR>
<A NAME="StringBuffer(java.lang.String)"><!-- --></A><H3>
StringBuffer</H3>
<PRE>
public <B>StringBuffer</B>(<A HREF="../../java/lang/String.html">String</A> str)</PRE>
<DL>
<DD>Constructs a string buffer so that it represents the same sequence of characters as the string argument; in other words, the initial contents of the string buffer is a copy of the argument string. The initial capacity of the string buffer is <code>16</code> plus the length of the string argument.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>str</CODE> - the initial contents of the buffer.</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="length()"><!-- --></A><H3>
length</H3>
<PRE>
public int <B>length</B>()</PRE>
<DL>
<DD>Returns the length (character count) of this string buffer.<DD><DL>
<DT><B>Returns:</B><DD>the length of the sequence of characters currently represented by this string buffer.</DL>
</DD>
</DL>
<HR>
<A NAME="capacity()"><!-- --></A><H3>
capacity</H3>
<PRE>
public int <B>capacity</B>()</PRE>
<DL>
<DD>Returns the current capacity of the String buffer. The capacity is the amount of storage available for newly inserted characters; beyond which an allocation will occur.<DD><DL>
<DT><B>Returns:</B><DD>the current capacity of this string buffer.</DL>
</DD>
</DL>
<HR>
<A NAME="ensureCapacity(int)"><!-- --></A><H3>
ensureCapacity</H3>
<PRE>
public void <B>ensureCapacity</B>(int minimumCapacity)</PRE>
<DL>
<DD>Ensures that the capacity of the buffer is at least equal to the specified minimum. If the current capacity of this string buffer is less than the argument, then a new internal buffer is allocated with greater capacity. The new capacity is the larger of: <ul> <li>The <code>minimumCapacity</code> argument. <li>Twice the old capacity, plus <code>2</code>. </ul> If the <code>minimumCapacity</code> argument is nonpositive, this method takes no action and simply returns.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>minimumCapacity</CODE> - the minimum desired capacity.</DL>
</DD>
</DL>
<HR>
<A NAME="setLength(int)"><!-- --></A><H3>
setLength</H3>
<PRE>
public void <B>setLength</B>(int newLength)</PRE>
<DL>
<DD>Sets the length of this String buffer. This string buffer is altered to represent a new character sequence whose length is specified by the argument. For every nonnegative index <i>k</i> less than <code>newLength</code>, the character at index <i>k</i> in the new character sequence is the same as the character at index <i>k</i> in the old sequence if <i>k</i> is less than the length of the old character sequence; otherwise, it is the null character <code>'