org.apache.wicket.util.string
Class PrependingStringBuffer

java.lang.Object
  extended by org.apache.wicket.util.string.PrependingStringBuffer

public class PrependingStringBuffer
extends java.lang.Object

This is a prepending stringbuffer optimized for constantly prepending strings to the front of the buffer.

Author:
jcompagner

Constructor Summary
PrependingStringBuffer()
          Default constructor, the internal initial buffer size will be 16
PrependingStringBuffer(int size)
          Constructs this PrependingStringBuffer with the given buffer size.
PrependingStringBuffer(java.lang.String start)
          Constructs and direct inserts the given string.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 int hashCode()
           
 int length()
          Returns the size of this PrependingStringBuffer
 PrependingStringBuffer prepend(char ch)
          Prepends one char to this PrependingStringBuffer
 PrependingStringBuffer prepend(java.lang.String str)
          Prepends the string to this PrependingStringBuffer
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PrependingStringBuffer

public PrependingStringBuffer()
Default constructor, the internal initial buffer size will be 16


PrependingStringBuffer

public PrependingStringBuffer(int size)
Constructs this PrependingStringBuffer with the given buffer size.

Parameters:
size - The initial size of the buffer.

PrependingStringBuffer

public PrependingStringBuffer(java.lang.String start)
Constructs and direct inserts the given string. The buffer size will be string.length+16

Parameters:
start - The string that is directly inserted.
Method Detail

prepend

public PrependingStringBuffer prepend(char ch)
Prepends one char to this PrependingStringBuffer

Parameters:
ch - The char that will be prepended
Returns:
this

prepend

public PrependingStringBuffer prepend(java.lang.String str)
Prepends the string to this PrependingStringBuffer

Parameters:
str - The string that will be prepended
Returns:
this

length

public int length()
Returns the size of this PrependingStringBuffer

Returns:
The size

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object


Copyright © 2004-2010 Apache Software Foundation. All Rights Reserved.