garydgregory commented on code in PR #666:
URL: https://github.com/apache/commons-compress/pull/666#discussion_r2055865206
##########
src/main/java/org/apache/commons/compress/compressors/zstandard/ZstdCompressorOutputStream.java:
##########
@@ -23,81 +23,535 @@
import java.io.OutputStream;
import org.apache.commons.compress.compressors.CompressorOutputStream;
+import org.apache.commons.io.build.AbstractStreamBuilder;
+import org.apache.commons.lang3.ArrayUtils;
+import org.tukaani.xz.LZMA2Options;
import com.github.luben.zstd.ZstdOutputStream;
/**
- * {@link CompressorOutputStream} implementation to create Zstandard encoded
stream. Library relies on <a href="https://github.com/luben/zstd-jni/">Zstandard
- * JNI</a>
+ * {@link CompressorOutputStream} implementation to create Zstandard encoded
stream.
+ * <p>
+ * This class avoids making the underlying {@code zstd} classes part of the
public or protected API. The underlying implementation is provided through the
+ * <a href="https://github.com/luben/zstd-jni/">Zstandard JNI</a> library
which is based on <a href="https://github.com/facebook/zstd/">zstd</a>.
+ * </p>
*
+ * @see <a href="https://github.com/luben/zstd-jni/">Zstandard JNI</a>
+ * @see <a href="https://github.com/facebook/zstd/">zstd</a>
* @since 1.16
*/
public class ZstdCompressorOutputStream extends
CompressorOutputStream<ZstdOutputStream> {
+ // @formatter:off
/**
- * Wraps the given stream into a zstd-jni ZstdOutputStream using the
default values for {@code level}, {@code
- * closeFrameOnFlush} and {@code useChecksum}.
+ * Builds a new {@link ZstdCompressorOutputStream}.
*
- * @param outStream the stream to write to
- * @throws IOException if zstd-jni does
+ * <p>
+ * For example:
+ * </p>
+ * <pre>{@code
+ * ZstdCompressorOutputStream s = ZstdCompressorOutputStream.builder()
+ * .setPath(path)
+ * .setLevel(3)
+ * .setStrategy(0)
+ * .setWorkers(0)
+ * .get();
+ * }
+ * </pre>
+ * <p>
+ * This class avoids making the underlying {@code zstd} classes part of
the public or protected API.
+ * </p>
+ *ZstdOutputStream
+ * @see #get()
+ * @see LZMA2Options
+ * @since 1.28.0
*/
+ // @formatter:on
+ public static class Builder extends
AbstractStreamBuilder<ZstdCompressorOutputStream, Builder> {
Review Comment:
@ppkarwasz,
Yes, makes sense.
--
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]