Skip to content

Commit

Permalink
Merge pull request #6 from joshmoore/blosc-multithread-read
Browse files Browse the repository at this point in the history
Allow configuration of default properties of blosc compressor
  • Loading branch information
joshmoore authored Jun 14, 2023
2 parents 5c6a217 + 2df7d17 commit 8453798
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/main/java/com/bc/zarr/CompressorFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<String, Object> defaultProperties = Collections
.unmodifiableMap(new HashMap<String, Object>() {{
public final static Map<String, Object> defaultProperties = new HashMap<String, Object>() {{
put(keyCname, defaultCname);
put(keyClevel, defaultCLevel);
put(keyShuffle, defaultShuffle);
put(keyBlocksize, defaultBlocksize);
put(keyNumThreads, defaultNumThreads);
}});
}};

private final int clevel;
private final int blocksize;
Expand Down Expand Up @@ -290,10 +289,11 @@ private BloscCompressor(Map<String, Object> 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();
Expand Down

0 comments on commit 8453798

Please sign in to comment.