@@ -41,6 +41,9 @@ public CodecBuilder withBlosc(
41
41
}
42
42
43
43
public CodecBuilder withBlosc (String cname , String shuffle , int clevel , int blockSize ) {
44
+ if (shuffle .equals ("shuffle" )){
45
+ shuffle = "byteshuffle" ;
46
+ }
44
47
return withBlosc (Blosc .Compressor .fromString (cname ), Blosc .Shuffle .fromString (shuffle ), clevel ,
45
48
dataType .getByteCount (), blockSize
46
49
);
@@ -62,13 +65,9 @@ public CodecBuilder withBlosc() {
62
65
return withBlosc ("zstd" );
63
66
}
64
67
65
- public CodecBuilder withTranspose (String order ) {
66
- try {
68
+ public CodecBuilder withTranspose (int [] order ) {
67
69
codecs .add (new TransposeCodec (new TransposeCodec .Configuration (order )));
68
- } catch (ZarrException e ) {
69
- throw new RuntimeException (e );
70
- }
71
- return this ;
70
+ return this ;
72
71
}
73
72
74
73
public CodecBuilder withBytes (Endian endian ) {
@@ -113,29 +112,40 @@ public CodecBuilder withZstd(int clevel) {
113
112
public CodecBuilder withSharding (int [] chunkShape ) {
114
113
try {
115
114
codecs .add (
116
- new ShardingIndexedCodec (new ShardingIndexedCodec .Configuration (chunkShape ,
117
- new Codec []{new BytesCodec (new Configuration (Endian .LITTLE ))},
118
- new Codec []{new BytesCodec (new Configuration (Endian .LITTLE )), new Crc32cCodec ()})));
115
+ new ShardingIndexedCodec (new ShardingIndexedCodec .Configuration (chunkShape ,
116
+ new Codec []{new BytesCodec (new Configuration (Endian .LITTLE ))},
117
+ new Codec []{new BytesCodec (new Configuration (Endian .LITTLE )), new Crc32cCodec ()},
118
+ "end" )));
119
119
} catch (ZarrException e ) {
120
120
throw new RuntimeException (e );
121
121
}
122
122
return this ;
123
123
}
124
124
125
125
public CodecBuilder withSharding (int [] chunkShape ,
126
- Function <CodecBuilder , CodecBuilder > codecBuilder ) {
126
+ Function <CodecBuilder , CodecBuilder > codecBuilder ) {
127
+ return withSharding (chunkShape , codecBuilder , "end" );
128
+ }
129
+
130
+ public CodecBuilder withSharding (int [] chunkShape ,
131
+ Function <CodecBuilder , CodecBuilder > codecBuilder , String indexLocation ) {
127
132
CodecBuilder nestedBuilder = new CodecBuilder (dataType );
128
133
try {
129
134
codecs .add (new ShardingIndexedCodec (
130
- new ShardingIndexedCodec .Configuration (chunkShape ,
131
- codecBuilder .apply (nestedBuilder ).build (),
132
- new Codec []{new BytesCodec (Endian .LITTLE ), new Crc32cCodec ()})));
135
+ new ShardingIndexedCodec .Configuration (chunkShape ,
136
+ codecBuilder .apply (nestedBuilder ).build (),
137
+ new Codec []{new BytesCodec (Endian .LITTLE ), new Crc32cCodec ()},
138
+ indexLocation )));
133
139
} catch (ZarrException e ) {
134
140
throw new RuntimeException (e );
135
141
}
136
142
return this ;
137
143
}
138
144
145
+ public CodecBuilder withCrc32c () {
146
+ codecs .add (new Crc32cCodec ());
147
+ return this ;
148
+ }
139
149
private void autoInsertBytesCodec () {
140
150
if (codecs .stream ().noneMatch (c -> c instanceof ArrayBytesCodec )) {
141
151
Codec [] arrayArrayCodecs = codecs .stream ().filter (c -> c instanceof ArrayArrayCodec )
0 commit comments