// Tests for getTerminalPosition private String getWordFromBinary(final DictDecoder dictDecoder, final int address) { if (dictDecoder.getPosition() != 0) dictDecoder.setPosition(0); DictionaryHeader fileHeader = null; try { fileHeader = dictDecoder.readHeader(); } catch (IOException e) { return null; } catch (UnsupportedFormatException e) { return null; } if (fileHeader == null) return null; return BinaryDictDecoderUtils.getWordAtPosition(dictDecoder, fileHeader.mBodyOffset, address) .mWord; }
@Override public FusionDictionary readDictionaryBinary( final FusionDictionary dict, final boolean deleteDictIfBroken) throws FileNotFoundException, IOException, UnsupportedFormatException { if (mDictBuffer == null) { openDictBuffer(); } try { return BinaryDictDecoderUtils.readDictionaryBinary(this, dict); } catch (IOException e) { Log.e(TAG, "The dictionary " + mDictDirectory.getName() + " is broken.", e); if (deleteDictIfBroken) { deleteDictFiles(); } throw e; } catch (UnsupportedFormatException e) { Log.e(TAG, "The dictionary " + mDictDirectory.getName() + " is broken.", e); if (deleteDictIfBroken) { deleteDictFiles(); } throw e; } }
@Override public int readPtNodeCount() { return BinaryDictDecoderUtils.readPtNodeCount(mDictBuffer); }