public synchronized boolean write(final byte[] data,final int offset,final boolean append){
  OutputStream out=null;
  try {
    out=new BufferedOutputStream(new FileOutputStream(file,append),data.length - offset);
    out.write(data,offset,data.length - offset);
    out.flush();
    return true;
  }
 catch (  final Exception ex) {
    if (Cfg.EXCEPTION) {
      Check.log(ex);
    }
    return false;
  }
 finally {
    if (out != null) {
      try {
        out.close();
      }
 catch (      final IOException e) {
        if (Cfg.EXCEPTION) {
          Check.log(e);
        }
        if (Cfg.DEBUG) {
          Check.log(TAG + " Error: " + e.toString());
        }
      }
    }
  }
}

public synchronized boolean write ( final byte [ ] data , final int offset , final boolean append ) { OutputStream out = null ; try { out = new BufferedOutputStream ( new FileOutputStream ( file , append ) , data . length - offset ) ; out . write ( data , offset , data . length - offset ) ; out . flush ( ) ; return true ; } catch ( final Exception ex ) { if ( Cfg . EXCEPTION ) { Check . log ( ex ) ; } return false ; } finally { if ( out != null ) { try { out . close ( ) ; } catch ( final IOException e ) { if ( Cfg . EXCEPTION ) { Check . log ( e ) ; } if ( Cfg . DEBUG ) { Check . log ( TAG + " Error: " + e . toString ( ) ) ; } } } } }
write a data buffer in the file , at a specific offset . if append is false the content of the file is overwritten .
