Top Description Fields Constructors Methods
org.mortbay.util

public Class Utf8StringBuffer

extends Object
Class Inheritance

UTF-8 StringBuffer. This class wraps a standard java.lang.StringBuffer and provides methods to append UTF-8 encoded bytes, that are converted into characters. This class is stateful and up to 6 calls to append(byte) may be needed before state a character is appended to the string buffer. The UTF-8 decoding is done by this class and no additional buffers or Readers are used. The UTF-8 code was inspired by http://javolution.org

Field Summary

Modifier and TypeField and Description
pack-priv int
pack-priv StringBuffer
pack-priv boolean
pack-priv int

Constructor Summary

AccessConstructor and Description
public
public
Utf8StringBuffer(int capacity)

Method Summary

Modifier and TypeMethod and Description
public void
append(byte[] b, int offset, int length)

public void
append(byte b)

public StringBuffer
public boolean

Returns:

True if there are non UTF-8 characters or incomplete UTF-8 characters in the buffer.
isError
()

public int
public void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

_bitsback to summary
pack-priv int _bits
_bufferback to summary
pack-priv StringBuffer _buffer
_errorsback to summary
pack-priv boolean _errors
_moreback to summary
pack-priv int _more

Constructor Detail

Utf8StringBufferback to summary
public Utf8StringBuffer()
Utf8StringBufferback to summary
public Utf8StringBuffer(int capacity)

Method Detail

appendback to summary
public void append(byte[] b, int offset, int length)
appendback to summary
public void append(byte b)
getStringBufferback to summary
public StringBuffer getStringBuffer()
isErrorback to summary
public boolean isError()
Returns:boolean

True if there are non UTF-8 characters or incomplete UTF-8 characters in the buffer.

lengthback to summary
public int length()
resetback to summary
public void reset()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.