public static int patchLessMemory(RandomAccessFile oldFile,File newFile,File diffFile,int extLen) throws IOException {
  if (oldFile == null || oldFile.length() <= 0) {
    return RETURN_OLD_FILE_ERR;
  }
  if (newFile == null) {
    return RETURN_NEW_FILE_ERR;
  }
  if (diffFile == null || diffFile.length() <= 0) {
    return RETURN_DIFF_FILE_ERR;
  }
  byte[] diffBytes=new byte[(int)diffFile.length()];
  InputStream diffInputStream=new FileInputStream(diffFile);
  try {
    BSUtil.readFromStream(diffInputStream,diffBytes,0,diffBytes.length);
  }
  finally {
    diffInputStream.close();
  }
  return patchLessMemory(oldFile,(int)oldFile.length(),diffBytes,diffBytes.length,newFile,extLen);
}

public static int patchLessMemory ( RandomAccessFile oldFile , File newFile , File diffFile , int extLen ) throws IOException { if ( oldFile == null || oldFile . length ( ) <= 0 ) { return RETURN_OLD_FILE_ERR ; } if ( newFile == null ) { return RETURN_NEW_FILE_ERR ; } if ( diffFile == null || diffFile . length ( ) <= 0 ) { return RETURN_DIFF_FILE_ERR ; } byte [ ] diffBytes = new byte [ ( int ) diffFile . length ( ) ] ; InputStream diffInputStream = new FileInputStream ( diffFile ) ; try { BSUtil . readFromStream ( diffInputStream , diffBytes , 0 , diffBytes . length ) ; } finally { diffInputStream . close ( ) ; } return patchLessMemory ( oldFile , ( int ) oldFile . length ( ) , diffBytes , diffBytes . length , newFile , extLen ) ; }
bspatch using less memory size . memory size = difffile size + max block size
