/** * @see {@link ArchiveStreamFactory#createArchiveInputStream(String, InputStream)} */ static ArchiveInputStream createArchiveInputStream(ArchiveFormat archiveFormat, InputStream in) throws ArchiveException { return createArchiveInputStream(archiveFormat.getName(), in); }
/** * @see {@link ArchiveStreamFactory#createArchiveInputStream(String, InputStream)} */ static ArchiveInputStream createArchiveInputStream(ArchiveFormat archiveFormat, InputStream in) throws ArchiveException { return createArchiveInputStream(archiveFormat.getName(), in); }
static ArchiveOutputStream createArchiveOutputStream(ArchiveFormat format, File archive) throws IOException, ArchiveException { return createArchiveOutputStream(format.getName(), new FileOutputStream(archive)); }
static ArchiveOutputStream createArchiveOutputStream(ArchiveFormat format, File archive) throws IOException, ArchiveException { return createArchiveOutputStream(format.getName(), new FileOutputStream(archive)); }
/** * Attempts to return the {@link ArchiveFormat} instance from a possible given string representation. Ignores case. * * @param archiveFormat string representation of the archive format. E.g. "tar" or "ZIP". * @return the compression type enum * @throws IllegalArgumentException if the given archive format is unknown. */ public static ArchiveFormat fromString(String archiveFormat) { for (ArchiveFormat format : values()) { if (archiveFormat.trim().equalsIgnoreCase(format.getName())) { return format; } } throw new IllegalArgumentException("Unknown archive format " + archiveFormat); }
/** * Checks if the given archive format name is valid and known format. * * @param archiveFormat the archive format name * @return true if the given archive format is known to the factory, false otherwise */ public static boolean isValidArchiveFormat(String archiveFormat) { for (ArchiveFormat format : values()) { if (archiveFormat.trim().equalsIgnoreCase(format.getName())) { return true; } } return false; }
/** * Checks if the given archive format name is valid and known format. * * @param archiveFormat the archive format name * @return true if the given archive format is known to the factory, false otherwise */ public static boolean isValidArchiveFormat(String archiveFormat) { for (ArchiveFormat format : values()) { if (archiveFormat.trim().equalsIgnoreCase(format.getName())) { return true; } } return false; }
/** * Attempts to return the {@link ArchiveFormat} instance from a possible given string representation. Ignores case. * * @param archiveFormat string representation of the archive format. E.g. "tar" or "ZIP". * @return the compression type enum * @throws IllegalArgumentException if the given archive format is unknown. */ public static ArchiveFormat fromString(String archiveFormat) { for (ArchiveFormat format : values()) { if (archiveFormat.trim().equalsIgnoreCase(format.getName())) { return format; } } throw new IllegalArgumentException("Unknown archive format " + archiveFormat); }