public void append ( String str ) { if ( str == null ) return ; int restLength = buffer . length - pos ; if ( str . length ( ) < restLength ) { str . getChars ( 0 , str . length ( ) , buffer , pos ) ; pos += str . length ( ) ; } else { str . getChars ( 0 , restLength , buffer , pos ) ; curr . next = new Entity ( buffer ) ; curr = curr . next ; length += buffer . length ; buffer = new char [ ( buffer . length > str . length ( ) - restLength ) ? buffer . length : str . length ( ) - restLength ] ; str . getChars ( restLength , str . length ( ) , buffer , 0 ) ; pos = str . length ( ) - restLength ; } }
Method to append a string to char buffer