blob: 115e42510d6fb27fb5670a8a87ca1814e52fb344 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.5.0_22) on Tue Sep 18 20:44:14 GMT+01:00 2012 -->
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
ByteArrayBuffer (HttpComponents Core 4.2.2 API)
</TITLE>
<META NAME="keywords" CONTENT="org.apache.http.util.ByteArrayBuffer class">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="ByteArrayBuffer (HttpComponents Core 4.2.2 API)";
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/ByteArrayBuffer.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;PREV CLASS&nbsp;
&nbsp;<A HREF="../../../../org/apache/http/util/CharArrayBuffer.html" title="class in org.apache.http.util"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?org/apache/http/util/ByteArrayBuffer.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="ByteArrayBuffer.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
org.apache.http.util</FONT>
<BR>
Class ByteArrayBuffer</H2>
<PRE>
<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">java.lang.Object</A>
<IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>org.apache.http.util.ByteArrayBuffer</B>
</PRE>
<DL>
<DT><B>All Implemented Interfaces:</B> <DD><A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/io/Serializable.html" title="class or interface in java.io">Serializable</A></DD>
</DL>
<HR>
<DL>
<DT><PRE><FONT SIZE="-1"><A HREF="../../../../org/apache/http/annotation/NotThreadSafe.html" title="annotation in org.apache.http.annotation">@NotThreadSafe</A>
</FONT>public final class <B>ByteArrayBuffer</B><DT>extends <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A><DT>implements <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/io/Serializable.html" title="class or interface in java.io">Serializable</A></DL>
</PRE>
<P>
A resizable byte array.
<P>
<P>
<DL>
<DT><B>Since:</B></DT>
<DD>4.0</DD>
<DT><B>See Also:</B><DD><A HREF="../../../../serialized-form.html#org.apache.http.util.ByteArrayBuffer">Serialized Form</A></DL>
<HR>
<P>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../org/apache/http/util/ByteArrayBuffer.html#ByteArrayBuffer(int)">ByteArrayBuffer</A></B>(int&nbsp;capacity)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates an instance of <A HREF="../../../../org/apache/http/util/ByteArrayBuffer.html" title="class in org.apache.http.util"><CODE>ByteArrayBuffer</CODE></A> with the given initial
capacity.</TD>
</TR>
</TABLE>
&nbsp;
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/http/util/ByteArrayBuffer.html#append(byte[], int, int)">append</A></B>(byte[]&nbsp;b,
int&nbsp;off,
int&nbsp;len)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Appends <code>len</code> bytes to this buffer from the given source
array starting at index <code>off</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/http/util/ByteArrayBuffer.html#append(char[], int, int)">append</A></B>(char[]&nbsp;b,
int&nbsp;off,
int&nbsp;len)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Appends <code>len</code> chars to this buffer from the given source
array starting at index <code>off</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/http/util/ByteArrayBuffer.html#append(org.apache.http.util.CharArrayBuffer, int, int)">append</A></B>(<A HREF="../../../../org/apache/http/util/CharArrayBuffer.html" title="class in org.apache.http.util">CharArrayBuffer</A>&nbsp;b,
int&nbsp;off,
int&nbsp;len)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Appends <code>len</code> chars to this buffer from the given source
char array buffer starting at index <code>off</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/http/util/ByteArrayBuffer.html#append(int)">append</A></B>(int&nbsp;b)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Appends <code>b</code> byte to this buffer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/http/util/ByteArrayBuffer.html#buffer()">buffer</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns reference to the underlying byte array.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/http/util/ByteArrayBuffer.html#byteAt(int)">byteAt</A></B>(int&nbsp;i)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the <code>byte</code> value in this buffer at the specified
index.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/http/util/ByteArrayBuffer.html#capacity()">capacity</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the current capacity.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/http/util/ByteArrayBuffer.html#clear()">clear</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Clears content of the buffer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/http/util/ByteArrayBuffer.html#ensureCapacity(int)">ensureCapacity</A></B>(int&nbsp;required)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ensures that the capacity 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>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/http/util/ByteArrayBuffer.html#indexOf(byte)">indexOf</A></B>(byte&nbsp;b)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the index within this buffer of the first occurrence of the
specified byte, starting the search at <code>0</code> and finishing
at <A HREF="../../../../org/apache/http/util/ByteArrayBuffer.html#length()"><CODE>length()</CODE></A>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/http/util/ByteArrayBuffer.html#indexOf(byte, int, int)">indexOf</A></B>(byte&nbsp;b,
int&nbsp;beginIndex,
int&nbsp;endIndex)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the index within this buffer of the first occurrence of the
specified byte, starting the search at the specified
<code>beginIndex</code> and finishing at <code>endIndex</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/http/util/ByteArrayBuffer.html#isEmpty()">isEmpty</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns <code>true</code> if this buffer is empty, that is, its
<A HREF="../../../../org/apache/http/util/ByteArrayBuffer.html#length()"><CODE>length()</CODE></A> is equal to <code>0</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/http/util/ByteArrayBuffer.html#isFull()">isFull</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns <code>true</code> if this buffer is full, that is, its
<A HREF="../../../../org/apache/http/util/ByteArrayBuffer.html#length()"><CODE>length()</CODE></A> is equal to its <A HREF="../../../../org/apache/http/util/ByteArrayBuffer.html#capacity()"><CODE>capacity()</CODE></A>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/http/util/ByteArrayBuffer.html#length()">length</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the length of the buffer (byte count).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/http/util/ByteArrayBuffer.html#setLength(int)">setLength</A></B>(int&nbsp;len)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the length of the buffer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/http/util/ByteArrayBuffer.html#toByteArray()">toByteArray</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Converts the content of this buffer to an array of bytes.</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="ByteArrayBuffer(int)"><!-- --></A><H3>
ByteArrayBuffer</H3>
<PRE>
public <B>ByteArrayBuffer</B>(int&nbsp;capacity)</PRE>
<DL>
<DD>Creates an instance of <A HREF="../../../../org/apache/http/util/ByteArrayBuffer.html" title="class in org.apache.http.util"><CODE>ByteArrayBuffer</CODE></A> with the given initial
capacity.
<P>
<DL>
<DT><B>Parameters:</B><DD><CODE>capacity</CODE> - the capacity</DL>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="append(byte[], int, int)"><!-- --></A><H3>
append</H3>
<PRE>
public void <B>append</B>(byte[]&nbsp;b,
int&nbsp;off,
int&nbsp;len)</PRE>
<DL>
<DD>Appends <code>len</code> bytes to this buffer from the given source
array starting at index <code>off</code>. The capacity of the buffer
is increased, if necessary, to accommodate all <code>len</code> bytes.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>b</CODE> - the bytes to be appended.<DD><CODE>off</CODE> - the index of the first byte to append.<DD><CODE>len</CODE> - the number of bytes to append.
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/IndexOutOfBoundsException.html" title="class or interface in java.lang">IndexOutOfBoundsException</A></CODE> - if <code>off</code> if out of
range, <code>len</code> is negative, or
<code>off</code> + <code>len</code> is out of range.</DL>
</DD>
</DL>
<HR>
<A NAME="append(int)"><!-- --></A><H3>
append</H3>
<PRE>
public void <B>append</B>(int&nbsp;b)</PRE>
<DL>
<DD>Appends <code>b</code> byte to this buffer. The capacity of the buffer
is increased, if necessary, to accommodate the additional byte.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>b</CODE> - the byte to be appended.</DL>
</DD>
</DL>
<HR>
<A NAME="append(char[], int, int)"><!-- --></A><H3>
append</H3>
<PRE>
public void <B>append</B>(char[]&nbsp;b,
int&nbsp;off,
int&nbsp;len)</PRE>
<DL>
<DD>Appends <code>len</code> chars to this buffer from the given source
array starting at index <code>off</code>. The capacity of the buffer
is increased if necessary to accommodate all <code>len</code> chars.
<p>
The chars are converted to bytes using simple cast.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>b</CODE> - the chars to be appended.<DD><CODE>off</CODE> - the index of the first char to append.<DD><CODE>len</CODE> - the number of bytes to append.
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/IndexOutOfBoundsException.html" title="class or interface in java.lang">IndexOutOfBoundsException</A></CODE> - if <code>off</code> if out of
range, <code>len</code> is negative, or
<code>off</code> + <code>len</code> is out of range.</DL>
</DD>
</DL>
<HR>
<A NAME="append(org.apache.http.util.CharArrayBuffer, int, int)"><!-- --></A><H3>
append</H3>
<PRE>
public void <B>append</B>(<A HREF="../../../../org/apache/http/util/CharArrayBuffer.html" title="class in org.apache.http.util">CharArrayBuffer</A>&nbsp;b,
int&nbsp;off,
int&nbsp;len)</PRE>
<DL>
<DD>Appends <code>len</code> chars to this buffer from the given source
char array buffer starting at index <code>off</code>. The capacity
of the buffer is increased if necessary to accommodate all
<code>len</code> chars.
<p>
The chars are converted to bytes using simple cast.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>b</CODE> - the chars to be appended.<DD><CODE>off</CODE> - the index of the first char to append.<DD><CODE>len</CODE> - the number of bytes to append.
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/IndexOutOfBoundsException.html" title="class or interface in java.lang">IndexOutOfBoundsException</A></CODE> - if <code>off</code> if out of
range, <code>len</code> is negative, or
<code>off</code> + <code>len</code> is out of range.</DL>
</DD>
</DL>
<HR>
<A NAME="clear()"><!-- --></A><H3>
clear</H3>
<PRE>
public void <B>clear</B>()</PRE>
<DL>
<DD>Clears content of the buffer. The underlying byte array is not resized.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="toByteArray()"><!-- --></A><H3>
toByteArray</H3>
<PRE>
public byte[] <B>toByteArray</B>()</PRE>
<DL>
<DD>Converts the content of this buffer to an array of bytes.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>byte array</DL>
</DD>
</DL>
<HR>
<A NAME="byteAt(int)"><!-- --></A><H3>
byteAt</H3>
<PRE>
public int <B>byteAt</B>(int&nbsp;i)</PRE>
<DL>
<DD>Returns the <code>byte</code> value in this buffer at the specified
index. The index argument must be greater than or equal to
<code>0</code>, and less than the length of this buffer.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>i</CODE> - the index of the desired byte value.
<DT><B>Returns:</B><DD>the byte value at the specified index.
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/IndexOutOfBoundsException.html" title="class or interface in java.lang">IndexOutOfBoundsException</A></CODE> - if <code>index</code> is
negative or greater than or equal to <A HREF="../../../../org/apache/http/util/ByteArrayBuffer.html#length()"><CODE>length()</CODE></A>.</DL>
</DD>
</DL>
<HR>
<A NAME="capacity()"><!-- --></A><H3>
capacity</H3>
<PRE>
public int <B>capacity</B>()</PRE>
<DL>
<DD>Returns the current capacity. The capacity is the amount of storage
available for newly appended bytes, beyond which an allocation
will occur.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>the current capacity</DL>
</DD>
</DL>
<HR>
<A NAME="length()"><!-- --></A><H3>
length</H3>
<PRE>
public int <B>length</B>()</PRE>
<DL>
<DD>Returns the length of the buffer (byte count).
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>the length of the buffer</DL>
</DD>
</DL>
<HR>
<A NAME="ensureCapacity(int)"><!-- --></A><H3>
ensureCapacity</H3>
<PRE>
public void <B>ensureCapacity</B>(int&nbsp;required)</PRE>
<DL>
<DD>Ensures that the capacity is at least equal to the specified minimum.
If the current capacity is less than the argument, then a new internal
array is allocated with greater capacity. If the <code>required</code>
argument is non-positive, this method takes no action.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>required</CODE> - the minimum required capacity.<DT><B>Since:</B></DT>
<DD>4.1</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="buffer()"><!-- --></A><H3>
buffer</H3>
<PRE>
public byte[] <B>buffer</B>()</PRE>
<DL>
<DD>Returns reference to the underlying byte array.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>the byte array.</DL>
</DD>
</DL>
<HR>
<A NAME="setLength(int)"><!-- --></A><H3>
setLength</H3>
<PRE>
public void <B>setLength</B>(int&nbsp;len)</PRE>
<DL>
<DD>Sets the length of the buffer. The new length value is expected to be
less than the current capacity and greater than or equal to
<code>0</code>.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>len</CODE> - the new length
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/IndexOutOfBoundsException.html" title="class or interface in java.lang">IndexOutOfBoundsException</A></CODE> - if the
<code>len</code> argument is greater than the current
capacity of the buffer or less than <code>0</code>.</DL>
</DD>
</DL>
<HR>
<A NAME="isEmpty()"><!-- --></A><H3>
isEmpty</H3>
<PRE>
public boolean <B>isEmpty</B>()</PRE>
<DL>
<DD>Returns <code>true</code> if this buffer is empty, that is, its
<A HREF="../../../../org/apache/http/util/ByteArrayBuffer.html#length()"><CODE>length()</CODE></A> is equal to <code>0</code>.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD><code>true</code> if this buffer is empty, <code>false</code>
otherwise.</DL>
</DD>
</DL>
<HR>
<A NAME="isFull()"><!-- --></A><H3>
isFull</H3>
<PRE>
public boolean <B>isFull</B>()</PRE>
<DL>
<DD>Returns <code>true</code> if this buffer is full, that is, its
<A HREF="../../../../org/apache/http/util/ByteArrayBuffer.html#length()"><CODE>length()</CODE></A> is equal to its <A HREF="../../../../org/apache/http/util/ByteArrayBuffer.html#capacity()"><CODE>capacity()</CODE></A>.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD><code>true</code> if this buffer is full, <code>false</code>
otherwise.</DL>
</DD>
</DL>
<HR>
<A NAME="indexOf(byte, int, int)"><!-- --></A><H3>
indexOf</H3>
<PRE>
public int <B>indexOf</B>(byte&nbsp;b,
int&nbsp;beginIndex,
int&nbsp;endIndex)</PRE>
<DL>
<DD>Returns the index within this buffer of the first occurrence of the
specified byte, starting the search at the specified
<code>beginIndex</code> and finishing at <code>endIndex</code>.
If no such byte occurs in this buffer within the specified bounds,
<code>-1</code> is returned.
<p>
There is no restriction on the value of <code>beginIndex</code> and
<code>endIndex</code>. If <code>beginIndex</code> is negative,
it has the same effect as if it were zero. If <code>endIndex</code> is
greater than <A HREF="../../../../org/apache/http/util/ByteArrayBuffer.html#length()"><CODE>length()</CODE></A>, it has the same effect as if it were
<A HREF="../../../../org/apache/http/util/ByteArrayBuffer.html#length()"><CODE>length()</CODE></A>. If the <code>beginIndex</code> is greater than
the <code>endIndex</code>, <code>-1</code> is returned.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>b</CODE> - the byte to search for.<DD><CODE>beginIndex</CODE> - the index to start the search from.<DD><CODE>endIndex</CODE> - the index to finish the search at.
<DT><B>Returns:</B><DD>the index of the first occurrence of the byte in the buffer
within the given bounds, or <code>-1</code> if the byte does
not occur.<DT><B>Since:</B></DT>
<DD>4.1</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="indexOf(byte)"><!-- --></A><H3>
indexOf</H3>
<PRE>
public int <B>indexOf</B>(byte&nbsp;b)</PRE>
<DL>
<DD>Returns the index within this buffer of the first occurrence of the
specified byte, starting the search at <code>0</code> and finishing
at <A HREF="../../../../org/apache/http/util/ByteArrayBuffer.html#length()"><CODE>length()</CODE></A>. If no such byte occurs in this buffer within
those bounds, <code>-1</code> is returned.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>b</CODE> - the byte to search for.
<DT><B>Returns:</B><DD>the index of the first occurrence of the byte in the
buffer, or <code>-1</code> if the byte does not occur.<DT><B>Since:</B></DT>
<DD>4.1</DD>
</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/ByteArrayBuffer.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;PREV CLASS&nbsp;
&nbsp;<A HREF="../../../../org/apache/http/util/CharArrayBuffer.html" title="class in org.apache.http.util"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?org/apache/http/util/ByteArrayBuffer.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="ByteArrayBuffer.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
Copyright &#169; 2005-2012 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved.
</BODY>
</HTML>