@WorkerThread
  public static LottieResult<LottieComposition> fromInputStreamSync(@Nullable Context context, InputStream inputStream, @Nullable String cacheKey) {
    final LottieComposition cachedComposition = cacheKey == null ? null : LottieCompositionCache.getInstance().get(cacheKey);
    if (cachedComposition != null) {
      return new LottieResult<>(cachedComposition);
    }
    try {
      BufferedSource source = Okio.buffer(source(inputStream));
      if (isZipCompressed(source)) {
        return fromZipStreamSync(context, new ZipInputStream(source.inputStream()), cacheKey);
      } else if (isGzipCompressed(source)) {
        return fromJsonInputStreamSync(new GZIPInputStream(source.inputStream()), cacheKey);
      }
      return fromJsonReaderSync(JsonReader.of(source), cacheKey);
    } catch (IOException e) {
      return new LottieResult<>(e);
    }
  }
Use this when you have an input stream but aren't sure if it is a json, zip, or gzip file.
This will read the file headers to see if it starts with the gzip or zip magic bytes.
@param context is optional and only needed if your zip file contains ttf or otf fonts. If yours doesn't, you may pass null.
               Embedded fonts may be .ttf or .otf files, can be in subdirectories, but must have the same name as the
               font family (fFamily) in your animation file.
lottie/src/main/java/com/airbnb/lottie/LottieCompositionFactory.java