use of com.github.luben.zstd.ZstdOutputStreamNoFinalizer in project presto by prestodb.
the class PrestoSparkUtils method serializeZstdCompressed.
public static <T> byte[] serializeZstdCompressed(Codec<T> codec, T instance) {
try (ByteArrayOutputStream output = new ByteArrayOutputStream();
ZstdOutputStreamNoFinalizer zstdOutput = new ZstdOutputStreamNoFinalizer(output)) {
codec.writeBytes(zstdOutput, instance);
zstdOutput.close();
output.close();
return output.toByteArray();
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
use of com.github.luben.zstd.ZstdOutputStreamNoFinalizer in project presto by prestodb.
the class HiveUtil method serializeZstdCompressed.
public static <T> byte[] serializeZstdCompressed(Codec<T> codec, T instance) {
try (ByteArrayOutputStream output = new ByteArrayOutputStream();
ZstdOutputStreamNoFinalizer zstdOutput = new ZstdOutputStreamNoFinalizer(output)) {
codec.writeBytes(zstdOutput, instance);
zstdOutput.close();
output.close();
return output.toByteArray();
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
Aggregations