railo.commons.lang
Class CharBuffer

java.lang.Object
  extended by railo.commons.lang.CharBuffer
Direct Known Subclasses:
DevNullCharBuffer

public class CharBuffer
extends Object

class to handle characters, similar to StringBuffer, but dont copy big blocks of char arrays.


Constructor Summary
CharBuffer()
          default constructor
CharBuffer(int size)
          constructor with size of the buffer
 
Method Summary
 void append(char c)
           
 void append(char[] c)
          method to appennd a charr array to the buffer
 void append(char[] c, int off, int len)
          method to append a part of a char array
 void append(String str)
          Method to append a string to char buffer
 void append(String str, int off, int len)
          method to append a part of a String
 void clear()
          clear the content of the buffer
 byte[] getBytes(String characterEncoding)
           
 int size()
           
 char[] toCharArray()
          return content of the Char Buffer as char array
 String toString()
          return the content of the buffer as string
 void writeOut(OutputStream os, String charset)
           
 void writeOut(Writer writer)
          method to writeout content of the char buffer in a writer, this ist faster than get char array with (toCharArray()) and write this in writer.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CharBuffer

public CharBuffer()
default constructor


CharBuffer

public CharBuffer(int size)
constructor with size of the buffer

Parameters:
size -
Method Detail

append

public void append(char c)

append

public void append(char[] c)
method to appennd a charr array to the buffer

Parameters:
c - char array to append

append

public void append(char[] c,
                   int off,
                   int len)
method to append a part of a char array

Parameters:
c - char array to get part from
off - start index on the char array
len - length of the sequenz to get from array

append

public void append(String str)
Method to append a string to char buffer

Parameters:
str - String to append

append

public void append(String str,
                   int off,
                   int len)
method to append a part of a String

Parameters:
str - string to get part from
off - start index on the string
len - length of the sequenz to get from string

writeOut

public void writeOut(Writer writer)
              throws IOException
method to writeout content of the char buffer in a writer, this ist faster than get char array with (toCharArray()) and write this in writer.

Parameters:
writer - writer to write inside
Throws:
IOException

writeOut

public void writeOut(OutputStream os,
                     String charset)
              throws IOException
Throws:
IOException

toCharArray

public char[] toCharArray()
return content of the Char Buffer as char array

Returns:
char array

toString

public String toString()
return the content of the buffer as string

Overrides:
toString in class Object
See Also:
Object.toString()

clear

public void clear()
clear the content of the buffer


size

public int size()
Returns:
returns the size of the content of the buffer

getBytes

public byte[] getBytes(String characterEncoding)
                throws UnsupportedEncodingException
Throws:
UnsupportedEncodingException


Copyright © 2012 Railo