yakovsh commented on code in PR #433:
URL: https://github.com/apache/commons-compress/pull/433#discussion_r1389641669
##########
src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java:
##########
@@ -226,10 +227,31 @@ private static Iterable<CompressorStreamProvider>
archiveStreamProviderIterable(
* @since 1.14
*/
public static String detect(final InputStream inputStream) throws
CompressorException {
+ final Set<String> defaultCompressorNamesForDetection =
+ Sets.newHashSet(BZIP2, GZIP, PACK200, SNAPPY_FRAMED, Z,
DEFLATE, XZ, LZMA, LZ4_FRAMED, ZSTANDARD);
+ return detect(inputStream, defaultCompressorNamesForDetection);
+ }
+ /**
+ * Try to detect the type of compressor stream while limiting the type to
the provided set of compressor names.
+ *
+ * @param inputStream input stream
+ * @param compressorNames compressor names to limit autodetection
+ * @return type of compressor stream detected
+ * @throws CompressorException if no compressor stream type was detected
+ * or if something else went wrong
+ * @throws IllegalArgumentException if stream is null or does not support
mark
+ *
+ * @since 1.24
+ */
+ public static String detect(final InputStream inputStream, final
Set<String> compressorNames) throws CompressorException {
Review Comment:
Will do. If this method is package-private does it need to be unit tested
directly?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]