/** * Creates a new HunspellDictionary containing the information read from the provided InputStreams to hunspell affix * and dictionary files. * You have to close the provided InputStreams yourself. * * @param affix InputStream for reading the hunspell affix file (won't be closed). * @param dictionaries InputStreams for reading the hunspell dictionary file (won't be closed). * @param version Lucene Version * @param ignoreCase If true, dictionary matching will be case insensitive * @throws IOException Can be thrown while reading from the InputStreams * @throws ParseException Can be thrown if the content of the files does not meet expected formats */ public HunspellDictionary(InputStream affix, List<InputStream> dictionaries, Version version, boolean ignoreCase) throws IOException, ParseException { this.version = version; this.ignoreCase = ignoreCase; String encoding = getDictionaryEncoding(affix); CharsetDecoder decoder = getJavaEncoding(encoding); readAffixFile(affix, decoder); words = new CharArrayMap<List<HunspellWord>>(version, 65535 /* guess */, this.ignoreCase); for (InputStream dictionary : dictionaries) { readDictionaryFile(dictionary, decoder); } }