private void resizeTo ( int length ) { if ( length <= 0 ) throw new IllegalArgumentException ( "length <= 0" ) ; if ( length != buff . length ) { int len = ( length > buff . length ) ? buff . length : length ; //System.out.println("resize:"+length); char [ ] obuff = buff ; buff = new char [ length ] ; /*for ( int j = 0; j < len; j++ ) { buff[j] = obuff[j]; }*/ System . arraycopy ( obuff , 0 , buff , 0 , len ) ; } }
resize the buffer this will have to copy the old chars from the old buffer to the new buffer