Skip to content

Commit

Permalink
fix BloscCodec with shuffle = "shuffle"
Browse files Browse the repository at this point in the history
  • Loading branch information
brokkoli71 committed Jun 3, 2024
1 parent db47786 commit 39ffce5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/main/java/dev/zarr/zarrjava/v3/codec/CodecBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ public CodecBuilder withBlosc(
}

public CodecBuilder withBlosc(String cname, String shuffle, int clevel, int blockSize) {
if (shuffle.equals("shuffle")){
shuffle = "byteshuffle";
}
return withBlosc(Blosc.Compressor.fromString(cname), Blosc.Shuffle.fromString(shuffle), clevel,
dataType.getByteCount(), blockSize
);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/dev/zarr/zarrjava/v3/codec/core/BloscCodec.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void serialize(Blosc.Shuffle shuffle, JsonGenerator generator,
generator.writeString("bitshuffle");
break;
case BYTE_SHUFFLE:
generator.writeString("byteshuffle");
generator.writeString("shuffle");
break;
}
}
Expand Down Expand Up @@ -154,7 +154,7 @@ public Blosc.Shuffle deserialize(JsonParser jsonParser, DeserializationContext c
return Blosc.Shuffle.NO_SHUFFLE;
case "bitshuffle":
return Blosc.Shuffle.BIT_SHUFFLE;
case "byteshuffle":
case "shuffle":
return Blosc.Shuffle.BYTE_SHUFFLE;
default:
throw new JsonParseException(
Expand Down

0 comments on commit 39ffce5

Please sign in to comment.