public void write(int c){
synchronized (lock) {
    int newcount=count + 1;
    if (newcount > buf.length) {
      buf=Arrays.copyOf(buf,Math.max(buf.length << 1,newcount));
    }
    buf[count]=(char)c;
    count=newcount;
  }
}

public void write ( int c ) { synchronized ( lock ) { int newcount = count + 1 ; if ( newcount > buf . length ) { buf = Arrays . copyOf ( buf , Math . max ( buf . length << 1 , newcount ) ) ; } buf [ count ] = ( char ) c ; count = newcount ; } }
writes a character to the buffer .
