code: public static Optional<MeteredInputStream> findWrappedMeteredInputStream(InputStream is) {
      if (is instanceof FilterInputStream) {
        try {
          Optional<MeteredInputStream> meteredInputStream =
              findWrappedMeteredInputStream(FilterStreamUnpacker.unpackFilterInputStream((FilterInputStream) is));
          if (meteredInputStream.isPresent()) {
            return meteredInputStream;
          }
        } catch (IllegalAccessException iae) {
          log.warn("Cannot unpack input stream due to SecurityManager.", iae);
          // Do nothing, we can't unpack the FilterInputStream due to security restrictions
        }
      }
      if (is instanceof MeteredInputStream) {
        return Optional.of((MeteredInputStream) is);
      }
      return Optional.absent();
    }
docs: Find the lowest {@link MeteredInputStream} in a chain of {@link FilterInputStream}s.