handle ZStd streams
This commit is contained in:
@@ -572,7 +572,6 @@ public class FullDataSourceV2Repo extends AbstractDhRepo<Long, FullDataSourceV2D
|
||||
EDhApiDataCompressionMode compressionModeEnum = EDhApiDataCompressionMode.getFromValue(compressionModeEnumValue);
|
||||
|
||||
// decompress the data
|
||||
|
||||
try
|
||||
{
|
||||
ByteArrayList byteArrayList = new ByteArrayList();
|
||||
|
||||
+8
-4
@@ -79,27 +79,31 @@ public class DhDataInputStream extends DataInputStream
|
||||
{
|
||||
super(warpStream(stream, compressionMode));
|
||||
}
|
||||
@SuppressWarnings("deprecation")
|
||||
private static InputStream warpStream(ByteArrayInputStream stream, EDhApiDataCompressionMode compressionMode) throws IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
switch (compressionMode)
|
||||
{
|
||||
case Z_STD:
|
||||
// ZStd compression should be handled before this point
|
||||
// just return the stream
|
||||
case UNCOMPRESSED:
|
||||
return stream;
|
||||
case LZ4:
|
||||
return new LZ4FrameInputStream(stream);
|
||||
case Z_STD:
|
||||
// ZStd compression should be handled before this point
|
||||
// just return the stream
|
||||
return stream;
|
||||
case LZMA2:
|
||||
// using an array cache significantly reduces GC pressure
|
||||
ResettableArrayCache arrayCache = LZMA_RESETTABLE_ARRAY_CACHE_GETTER.get();
|
||||
arrayCache.reset();
|
||||
|
||||
// Note: all LZMA/XZ compressors can be decompressed using this same InputStream
|
||||
return new XZInputStream(stream, arrayCache);
|
||||
|
||||
case Z_STD_STREAM: // deprecated, only used for legacy support
|
||||
return new ZstdInputStream(stream, RecyclingBufferPool.INSTANCE);
|
||||
|
||||
default:
|
||||
throw new IllegalArgumentException("No compressor defined for [" + compressionMode + "]");
|
||||
}
|
||||
|
||||
+4
@@ -66,6 +66,7 @@ public class DhDataOutputStream extends DataOutputStream
|
||||
this.outputByteArray = outputByteArray;
|
||||
this.compressionMode = compressionMode;
|
||||
}
|
||||
@SuppressWarnings("deprecation")
|
||||
private static OutputStream warpStream(ByteArrayOutputStream stream, EDhApiDataCompressionMode compressionMode) throws IOException
|
||||
{
|
||||
try
|
||||
@@ -96,6 +97,9 @@ public class DhDataOutputStream extends DataOutputStream
|
||||
return new XZOutputStream(stream, new LZMA2Options(3),
|
||||
XZ.CHECK_CRC64, arrayCache);
|
||||
|
||||
case Z_STD_STREAM: // deprecated, only used for legacy support
|
||||
throw new UnsupportedOperationException("Z_Std streams is deprecated and shouldn't be used for encoding. The faster block encoding format should be used instead.");
|
||||
|
||||
default:
|
||||
throw new IllegalArgumentException("No compressor defined for ["+compressionMode+"]");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user