@Override
 public void fromBinary(final byte[] bytes) {
   final ByteBuffer buf = ByteBuffer.wrap(bytes);
   final int numSfcs = buf.getInt();
   final int numDimensions = buf.getInt();
   final int mappingSize = buf.getInt();
   maxEstimatedDuplicateIds = buf.getLong();
   maxEstimatedDuplicateIdsBigInteger = BigInteger.valueOf(maxEstimatedDuplicateIds);
   orderedSfcs = new SpaceFillingCurve[numSfcs];
   baseDefinitions = new NumericDimensionDefinition[numDimensions];
   for (int i = 0; i < numSfcs; i++) {
     final byte[] sfc = new byte[buf.getInt()];
     buf.get(sfc);
     orderedSfcs[i] = PersistenceUtils.fromBinary(sfc, SpaceFillingCurve.class);
   }
   for (int i = 0; i < numDimensions; i++) {
     final byte[] dim = new byte[buf.getInt()];
     buf.get(dim);
     baseDefinitions[i] = PersistenceUtils.fromBinary(dim, NumericDimensionDefinition.class);
   }
   final Builder<Integer, Byte> bimapBuilder = ImmutableBiMap.builder();
   for (int i = 0; i < mappingSize; i++) {
     bimapBuilder.put(Byte.valueOf(buf.get()).intValue(), buf.get());
   }
   orderedSfcIndexToTierId = bimapBuilder.build();
 }
 @SuppressWarnings("unchecked")
 protected T entryToValue(final Entry<Key, Value> entry) {
   final T result = (T) PersistenceUtils.fromBinary(entry.getValue().get(), Persistable.class);
   if (result != null) {
     addObjectToCache(getPrimaryId(result), getSecondaryId(result), result);
   }
   return result;
 }
 @Override
 public void fromBinary(final byte[] bytes) {
   final ByteBuffer buf = ByteBuffer.wrap(bytes);
   try {
     final int indexStrategyLength = buf.getInt();
     final byte[] indexStrategyBytes = new byte[indexStrategyLength];
     buf.get(indexStrategyBytes);
     indexStrategy = PersistenceUtils.fromBinary(indexStrategyBytes, NumericIndexStrategy.class);
     final byte[] coordRangeBytes = new byte[bytes.length - indexStrategyLength - 4];
     buf.get(coordRangeBytes);
     final ArrayOfArrays arrays = new ArrayOfArrays();
     arrays.fromBinary(coordRangeBytes);
     coordinateRanges = arrays.getCoordinateArrays();
     rangeCache = RangeLookupFactory.createMultiRangeLookup(coordinateRanges);
   } catch (final Exception e) {
     LOGGER.warn("Unable to read parameters", e);
   }
 }
 @Override
 public void init(
     final SortedKeyValueIterator<Key, Value> source,
     final Map<String, String> options,
     final IteratorEnvironment env)
     throws IOException {
   this.source = source;
   if (options == null) {
     throw new IllegalArgumentException(
         "Arguments must be set for " + NumericIndexStrategyFilterIterator.class.getName());
   }
   try {
     if (options.containsKey(INDEX_STRATEGY_KEY)) {
       final String idxStrategyStr = options.get(INDEX_STRATEGY_KEY);
       final byte[] idxStrategyBytes = ByteArrayUtils.byteArrayFromString(idxStrategyStr);
       indexStrategy = PersistenceUtils.fromBinary(idxStrategyBytes, NumericIndexStrategy.class);
     } else {
       throw new IllegalArgumentException(
           "'"
               + INDEX_STRATEGY_KEY
               + "' must be set for "
               + NumericIndexStrategyFilterIterator.class.getName());
     }
     if (options.containsKey(COORDINATE_RANGE_KEY)) {
       final String coordRangeStr = options.get(COORDINATE_RANGE_KEY);
       final byte[] coordRangeBytes = ByteArrayUtils.byteArrayFromString(coordRangeStr);
       final ArrayOfArrays arrays = new ArrayOfArrays();
       arrays.fromBinary(coordRangeBytes);
       rangeCache = RangeLookupFactory.createMultiRangeLookup(arrays.getCoordinateArrays());
     } else {
       throw new IllegalArgumentException(
           "'"
               + COORDINATE_RANGE_KEY
               + "' must be set for "
               + NumericIndexStrategyFilterIterator.class.getName());
     }
   } catch (final Exception e) {
     throw new IllegalArgumentException(e);
   }
 }