/** * Add list of word to idx, dict file, modify size .ifo file. * * @param pWord word that is added * @param pMean word mean * @return true if success */ public boolean addListOfWords(String[] pWord, String[] pMean) { if (pWord.length != pMean.length || pWord.length == 0) { return false; } try { for (int i = 0; i < pWord.length; i++) { String strLwrWord = pWord[i].toLowerCase(); int pos = (int) idxFile.findIndexForWord(strLwrWord); boolean bExist = false; if (pos < (int) idxFile.getLongWordCount()) { if (strLwrWord.compareTo(((WordEntry) idxFile.getEntryList().get(pos)).getStrLwrWord()) == 0) { bExist = true; } } long nextOffset = dictFile.addData(pMean[i]); if (nextOffset >= 0) { if (!bExist) { idxFile.addEntry(pWord[i], nextOffset, pMean[i].length(), pos); } else { WordEntry tempEntry = idxFile.getEntryList().get(pos); tempEntry.setLongOffset(nextOffset); tempEntry.setLongSize(pMean[i].length()); } } } idxFile.write(); ifoFile.setLongIdxFileSize(idxFile.getLongIdxFileSize()); ifoFile.setLongWordCount(idxFile.getLongWordCount()); ifoFile.write(); } catch (Exception ex) { return false; } return true; }