public CharBuffer replace(int start,int end,char[] buffer,int offset,int len){
  int length=length();
  if (start < 0 || end < start || length < start)   throw new StringIndexOutOfBoundsException();
  ensureCapacity(len + length - (end - start));
  char[] thisBuffer=buffer();
  if (len < end - start) {
    int tail=length - end;
    for (int i=0; i < tail; i++)     thisBuffer[start + len + i]=thisBuffer[end + i];
  }
 else {
    int tail=length - end;
    for (int i=tail - 1; i >= 0; i--)     thisBuffer[end + i]=thisBuffer[start + len + i];
  }
  System.arraycopy(buffer,offset,thisBuffer,start,len);
  length(length + len - (end - start));
  return this;
}

public CharBuffer replace ( int start , int end , char [ ] buffer , int offset , int len ) { int length = length ( ) ; if ( start < 0 || end < start || length < start ) throw new StringIndexOutOfBoundsException ( ) ; ensureCapacity ( len + length - ( end - start ) ) ; char [ ] thisBuffer = buffer ( ) ; if ( len < end - start ) { int tail = length - end ; for ( int i = 0 ; i < tail ; i ++ ) thisBuffer [ start + len + i ] = thisBuffer [ end + i ] ; } else { int tail = length - end ; for ( int i = tail - 1 ; i >= 0 ; i -- ) thisBuffer [ end + i ] = thisBuffer [ start + len + i ] ; } System . arraycopy ( buffer , offset , thisBuffer , start , len ) ; length ( length + len - ( end - start ) ) ; return this ; }
replaces a range with a character array
