@@ -0,0 +1,2162 @@
+/*%0A * Copyright (c) 2011-2013 Spotify AB%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22); you may not%0A * use this file except in compliance with the License. You may obtain a copy of%0A * the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS, WITHOUT%0A * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the%0A * License for the specific language governing permissions and limitations under%0A * the License.%0A */%0Apackage com.spotify.sparkey;%0A%0Aimport java.io.IOException;%0A%0Aimport com.github.luben.zstd.Zstd;%0A%0Aimport org.xerial.snappy.Snappy;%0A%0Apublic enum CompressorType %7B%0A  SNAPPY %7B%0A    @Override%0A    int maxCompressedLength(int blockSize) %7B%0A      return Snappy.maxCompressedLength(blockSize);%0A    %7D%0A%0A    @Override%0A    int uncompress(byte%5B%5D compressed, int compressedSize, byte%5B%5D uncompressed) throws IOException %7B%0A      return Snappy.uncompress(compressed, 0, compressedSize, uncompressed, 0);%0A    %7D%0A  %0A    @Override%0A    int compress(byte%5B%5D uncompressed, int uncompressedSize, byte%5B%5D compressed) throws IOException %7B%0A      return Snappy.compress(uncompressed, 0, uncompressedSize, compressed, 0);%0A    %7D%0A  %7D,%0A%0A  ZSTD %7B%0A    @Override%0A    int maxCompressedLength(int blockSize) %7B%0A      return (int)Zstd.compressBound(blockSize);%0A    %7D%0A%0A    @Override%0A    int uncompress(byte%5B%5D compressed, int compressedSize, byte%5B%5D uncompressed) throws IOException %7B%0A      return (int)Zstd.decompressByteArray(uncompressed, 0, uncompressed.length, compressed, 0, compressedSize);%0A    %7D%0A  %0A    @Override%0A    int compress(byte%5B%5D uncompressed, int uncompressedSize, byte%5B%5D compressed) throws IOException %7B%0A      return (int)Zstd.compressByteArray(compressed, 0, compressed.length, uncompressed, 0, uncompressedSize, 3);%0A    %7D%0A  %7D,;%0A%0A  abstract int maxCompressedLength(int blockSize);%0A%0A  abstract int uncompress(byte%5B%5D compressed, int compressedSize, byte%5B%5D uncompressed) throws IOException;%0A%0A  abstract int compress(byte%5B%5D uncompressed, int uncompressedSize, byte%5B%5D compressed) throws IOException;%0A%7D

add compressor types