@Test public void extractDescriptionFromTar() throws Exception { Map<String, String> attributes = extractDescriptionFromArchive("r-package.tar.gz", loadFile("r-package.tar.gz")); assertAttributes(attributes); }
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); }
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); } }
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(); }
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(); static Map<String, String> extractDescriptionFromArchive(final String filename, InputStream is); }
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(); static Map<String, String> extractDescriptionFromArchive(final String filename, InputStream is);  }