java.lang.Appendable
, java.lang.CharSequence
public class ByteBuilder
extends java.lang.Object
implements java.lang.CharSequence, java.lang.Appendable
Constructor | Description |
---|---|
ByteBuilder(int maxCapacity) |
Constructs a ByteBuilder that will never grow beyond
maxCapacity
bytes in length. |
Modifier and Type | Method | Description |
---|---|---|
ByteBuilder |
append(char c) |
Appends an ASCII character (see
isCharacterAscii(char) ) to this ByteBuilder. |
ByteBuilder |
append(java.lang.CharSequence charSequence) |
Appends an ASCII CharSequence to this ByteBuilder.
|
ByteBuilder |
append(java.lang.CharSequence csq,
int start,
int end) |
|
char |
charAt(int index) |
|
static boolean |
isCharacterAscii(char c) |
|
int |
length() |
|
java.lang.CharSequence |
subSequence(int start,
int end) |
|
java.lang.String |
toString() |
public ByteBuilder(int maxCapacity)
maxCapacity
bytes in length. If you don't want to limit the size this ByteBuilder can
grow to, you should pass in Integer.MAX_VALUE heremaxCapacity
- The maximum, NOT the initial capacity of this ByteBuilderpublic static boolean isCharacterAscii(char c)
public ByteBuilder append(char c)
isCharacterAscii(char)
) to this ByteBuilder.append
in interface java.lang.Appendable
c
- ASCII character to appendjava.lang.IllegalArgumentException
- if c is not an ASCII characterpublic ByteBuilder append(java.lang.CharSequence charSequence) throws java.io.IOException
append
in interface java.lang.Appendable
charSequence
- ASCII CharSequence to appendjava.lang.IllegalArgumentException
- if charSequence contains non-ASCII charactersjava.io.IOException
public ByteBuilder append(java.lang.CharSequence csq, int start, int end) throws java.io.IOException
append
in interface java.lang.Appendable
java.io.IOException
public int length()
length
in interface java.lang.CharSequence
public char charAt(int index)
charAt
in interface java.lang.CharSequence
public java.lang.CharSequence subSequence(int start, int end)
subSequence
in interface java.lang.CharSequence
public java.lang.String toString()
toString
in interface java.lang.CharSequence
toString
in class java.lang.Object
http://code.google.com/p/jebl2/