@Override public void write(byte[] b,int off,int len){
  if ((off < 0) || (off > b.length) || (len < 0)|| ((off + len) > b.length)|| ((off + len) < 0)) {
    throw new IndexOutOfBoundsException();
  }
 else   if (len == 0) {
    return;
  }
synchronized (this) {
    int newcount=count + len;
    int remaining=len;
    int inBufferPos=count - filledBufferSum;
    while (remaining > 0) {
      int part=Math.min(remaining,currentBuffer.length - inBufferPos);
      System.arraycopy(b,off + len - remaining,currentBuffer,inBufferPos,part);
      remaining-=part;
      if (remaining > 0) {
        needNewBuffer(newcount);
        inBufferPos=0;
      }
    }
    count=newcount;
  }
}

@ Override public void write ( byte [ ] b , int off , int len ) { if ( ( off < 0 ) || ( off > b . length ) || ( len < 0 ) || ( ( off + len ) > b . length ) || ( ( off + len ) < 0 ) ) { throw new IndexOutOfBoundsException ( ) ; } else if ( len == 0 ) { return ; } synchronized ( this ) { int newcount = count + len ; int remaining = len ; int inBufferPos = count - filledBufferSum ; while ( remaining > 0 ) { int part = Math . min ( remaining , currentBuffer . length - inBufferPos ) ; System . arraycopy ( b , off + len - remaining , currentBuffer , inBufferPos , part ) ; remaining -= part ; if ( remaining > 0 ) { needNewBuffer ( newcount ) ; inBufferPos = 0 ; } } count = newcount ; } }
write the bytes to byte array .
