use of uk.gov.gchq.gaffer.accumulostore.key.exception.BloomFilterIteratorException in project Gaffer by gchq.
the class CoreKeyBloomFilterIterator method validateOptions.
@Override
public boolean validateOptions(final Map<String, String> options) {
if (!super.validateOptions(options)) {
return false;
}
if (!options.containsKey(AccumuloStoreConstants.BLOOM_FILTER)) {
throw new BloomFilterIteratorException("Must set the " + AccumuloStoreConstants.BLOOM_FILTER + " option");
}
filter = new BloomFilter();
final byte[] bytes;
try {
bytes = options.get(AccumuloStoreConstants.BLOOM_FILTER).getBytes(AccumuloStoreConstants.BLOOM_FILTER_CHARSET);
} catch (UnsupportedEncodingException e) {
throw new BloomFilterIteratorException("Failed to re-create serialised bloom filter", e);
}
try (final InputStream inStream = new ByteArrayInputStream(bytes);
final DataInputStream dataStream = new DataInputStream(inStream)) {
filter.readFields(dataStream);
} catch (final IOException e) {
throw new BloomFilterIteratorException("Failed to re-create serialised bloom filter", e);
}
return true;
}
Aggregations