private void writeStuffed(byte[] b,int off,int len) throws IOException {
  int n=off + len;
  for (int i=off; i < n; i++) {
    if (b[i] == -1) {
      out.write(b,off,i - off + 1);
      out.write(0);
      off=i + 1;
    }
  }
  if (n - off > 0) {
    out.write(b,off,n - off);
  }
}

private void writeStuffed ( byte [ ] b , int off , int len ) throws IOException { int n = off + len ; for ( int i = off ; i < n ; i ++ ) { if ( b [ i ] == - 1 ) { out . write ( b , off , i - off + 1 ) ; out . write ( 0 ) ; off = i + 1 ; } } if ( n - off > 0 ) { out . write ( b , off , n - off ) ; } }
writes stuffed bytes to the underlying output stream .
