diff --git a/src/main/java/com/bc/zarr/CompressorFactory.java b/src/main/java/com/bc/zarr/CompressorFactory.java index 4465164..d32a29a 100644 --- a/src/main/java/com/bc/zarr/CompressorFactory.java +++ b/src/main/java/com/bc/zarr/CompressorFactory.java @@ -208,7 +208,7 @@ public void uncompress(InputStream is, OutputStream os) throws IOException { } } - static class BloscCompressor extends Compressor { + public static class BloscCompressor extends Compressor { final static int AUTOSHUFFLE = -1; final static int NOSHUFFLE = 0; @@ -228,14 +228,13 @@ static class BloscCompressor extends Compressor { public final static int[] supportedShuffle = new int[]{/*AUTOSHUFFLE, */NOSHUFFLE, BYTESHUFFLE, BITSHUFFLE}; public final static String[] supportedCnames = new String[]{"zstd", "blosclz", defaultCname, "lz4hc", "zlib"/*, "snappy"*/}; - public final static Map defaultProperties = Collections - .unmodifiableMap(new HashMap() {{ + public final static Map defaultProperties = new HashMap() {{ put(keyCname, defaultCname); put(keyClevel, defaultCLevel); put(keyShuffle, defaultShuffle); put(keyBlocksize, defaultBlocksize); put(keyNumThreads, defaultNumThreads); - }}); + }}; private final int clevel; private final int blocksize; @@ -290,10 +289,11 @@ private BloscCompressor(Map map) { this.blocksize = ((Number) blocksizeObj).intValue(); } - final Object nthreadsObj = map.get(keyNumThreads); + Object nthreadsObj = map.get(keyNumThreads); if (nthreadsObj == null) { - this.nthreads = defaultNumThreads; - } else if (nthreadsObj instanceof String) { + nthreadsObj = defaultProperties.get(keyNumThreads); + } + if (nthreadsObj instanceof String) { this.nthreads = Integer.parseInt((String) nthreadsObj); } else { this.nthreads = ((Number) nthreadsObj).intValue();