@@ -561,10 +561,12 @@ public static long decompressDirectByteBufferFastDict(ByteBuffer dst, int dstOff
561
561
public static native int loadDictCompress (long stream , byte [] dict , int dict_size );
562
562
public static native int loadFastDictCompress (long stream , ZstdDictCompress dict );
563
563
public static native int setCompressionChecksums (long stream , boolean useChecksums );
564
+ public static native int setCompressionMagicless (long stream , boolean useMagicless );
564
565
public static native int setCompressionLevel (long stream , int level );
565
566
public static native int setCompressionLong (long stream , int windowLog );
566
567
public static native int setCompressionWorkers (long stream , int workers );
567
568
public static native int setDecompressionLongMax (long stream , int windowLogMax );
569
+ public static native int setDecompressionMagicless (long stream , boolean useMagicless );
568
570
569
571
/* Utility methods */
570
572
@@ -574,21 +576,35 @@ public static long decompressDirectByteBufferFastDict(ByteBuffer dst, int dstOff
574
576
* @param src the compressed buffer
575
577
* @param srcPosition offset of the compressed data inside the src buffer
576
578
* @param srcSize length of the compressed data inside the src buffer
579
+ * @param magicless whether the buffer contains a magicless frame
577
580
* @return the number of bytes of the original buffer
578
581
* 0 if the original size is not known
579
582
*/
580
- public static long decompressedSize (byte [] src , int srcPosition , int srcSize ) {
583
+ public static long decompressedSize (byte [] src , int srcPosition , int srcSize , boolean magicless ) {
581
584
if (srcPosition >= src .length ) {
582
585
throw new ArrayIndexOutOfBoundsException (srcPosition );
583
586
}
584
587
if (srcPosition + srcSize > src .length ) {
585
588
throw new ArrayIndexOutOfBoundsException (srcPosition + srcSize );
586
589
}
587
- return decompressedSize0 (src , srcPosition , srcSize );
590
+ return decompressedSize0 (src , srcPosition , srcSize , magicless );
588
591
}
589
592
590
- private static native long decompressedSize0 (byte [] src , int srcPosition , int srcSize );
593
+ private static native long decompressedSize0 (byte [] src , int srcPosition , int srcSize , boolean magicless );
591
594
595
+ /**
596
+ * Return the original size of a compressed buffer (if known)
597
+ *
598
+ * @param src the compressed buffer
599
+ * @param srcPosition offset of the compressed data inside the src buffer
600
+ * @param srcSize length of the compressed data inside the src buffer
601
+ * @return the number of bytes of the original buffer
602
+ * 0 if the original size is not known
603
+ */
604
+ public static long decompressedSize (byte [] src , int srcPosition , int srcSize ) {
605
+ return decompressedSize (src , srcPosition , srcSize , false );
606
+ }
607
+
592
608
/**
593
609
* Return the original size of a compressed buffer (if known)
594
610
*
@@ -618,10 +634,24 @@ public static long decompressedSize(byte[] src) {
618
634
* @param src the compressed buffer
619
635
* @param srcPosition offset of the compressed data inside the src buffer
620
636
* @param srcSize length of the compressed data inside the src buffe
637
+ * @param magicless whether the buffer contains a magicless frame
621
638
* @return the number of bytes of the original buffer
622
639
* 0 if the original size is not known
623
640
*/
624
- public static native long decompressedDirectByteBufferSize (ByteBuffer src , int srcPosition , int srcSize );
641
+ public static native long decompressedDirectByteBufferSize (ByteBuffer src , int srcPosition , int srcSize , boolean magicless );
642
+
643
+ /**
644
+ * Return the original size of a compressed buffer (if known)
645
+ *
646
+ * @param src the compressed buffer
647
+ * @param srcPosition offset of the compressed data inside the src buffer
648
+ * @param srcSize length of the compressed data inside the src buffe
649
+ * @return the number of bytes of the original buffer
650
+ * 0 if the original size is not known
651
+ */
652
+ public static long decompressedDirectByteBufferSize (ByteBuffer src , int srcPosition , int srcSize ) {
653
+ return decompressedDirectByteBufferSize (src , srcPosition , srcSize , false );
654
+ }
625
655
626
656
/**
627
657
* Maximum size of the compressed data
0 commit comments