class RDescriptionUtils {

  public static Map<String, String> extractDescriptionFromArchive(final String filename, InputStream is) {
    checkNotNull(filename);
    checkNotNull(is);
    final String lowerCaseFilename = filename.toLowerCase();
    if (lowerCaseFilename.endsWith(".tar.gz") || lowerCaseFilename.endsWith(".tgz")) {
      return extractMetadataFromTgz(is);
    }
    else if (lowerCaseFilename.endsWith(".gz")) {
      return extractMetadataFromGz(is);
    }
    else if (lowerCaseFilename.endsWith(".zip")) {
      return extractMetadataFromZip(is);
    }
    throw new IllegalStateException("Unexpected file extension for file: " + filename);
  }

  private  RDescriptionUtils();

}