1212import dev .zarr .zarrjava .store .StoreHandle ;
1313import dev .zarr .zarrjava .utils .MultiArrayUtils ;
1414import dev .zarr .zarrjava .v3 .*;
15+ import dev .zarr .zarrjava .v3 .codec .CodecBuilder ;
1516import dev .zarr .zarrjava .v3 .codec .core .TransposeCodec ;
1617import org .junit .jupiter .api .Assertions ;
1718import org .junit .jupiter .api .BeforeAll ;
@@ -92,17 +93,9 @@ public void testReadFromZarrita(String codec) throws IOException, ZarrException,
9293 Assertions .assertArrayEquals (expectedData , (int []) result .get1DJavaArray (ucar .ma2 .DataType .INT ));
9394 }
9495
95- private void copy (InputStream inputStream , OutputStream outputStream ) throws IOException {
96- byte [] buffer = new byte [4096 ];
97- int len ;
98- while ((len = inputStream .read (buffer )) > 0 ) {
99- outputStream .write (buffer , 0 , len );
100- }
101- }
102-
10396 @ CsvSource ({"0,true" , "0,false" , "5, true" , "10, false" })
10497 @ ParameterizedTest
105- public void testZstdLibrary (int clevel , boolean checksumFlag ) throws IOException , InterruptedException , ZarrException {
98+ public void testZstdLibrary (int clevel , boolean checksumFlag ) throws IOException , InterruptedException {
10699 //compress using ZstdCompressCtx
107100 int number = 123456 ;
108101 byte [] src = ByteBuffer .allocate (4 ).putInt (number ).array ();
@@ -147,10 +140,10 @@ public void testWriteToZarrita(String codec) throws IOException, ZarrException,
147140
148141 switch (codec ) {
149142 case "blosc" :
150- builder = builder .withCodecs (c -> c . withBlosc () );
143+ builder = builder .withCodecs (CodecBuilder :: withBlosc );
151144 break ;
152145 case "gzip" :
153- builder = builder .withCodecs (c -> c . withGzip () );
146+ builder = builder .withCodecs (CodecBuilder :: withGzip );
154147 break ;
155148 case "zstd" :
156149 builder = builder .withCodecs (c -> c .withZstd (0 ));
@@ -203,7 +196,7 @@ public void testWriteToZarrita(String codec) throws IOException, ZarrException,
203196
204197 @ ParameterizedTest
205198 @ ValueSource (strings = {"blosc" , "gzip" , "zstd" , "bytes" , "transpose" , "sharding_start" , "sharding_end" })
206- public void testCodecsWriteRead (String codec ) throws IOException , ZarrException , InterruptedException {
199+ public void testCodecsWriteRead (String codec ) throws IOException , ZarrException {
207200 int [] testData = new int [16 * 16 * 16 ];
208201 Arrays .setAll (testData , p -> p );
209202
@@ -217,10 +210,10 @@ public void testCodecsWriteRead(String codec) throws IOException, ZarrException,
217210
218211 switch (codec ) {
219212 case "blosc" :
220- builder = builder .withCodecs (c -> c . withBlosc () );
213+ builder = builder .withCodecs (CodecBuilder :: withBlosc );
221214 break ;
222215 case "gzip" :
223- builder = builder .withCodecs (c -> c . withGzip () );
216+ builder = builder .withCodecs (CodecBuilder :: withGzip );
224217 break ;
225218 case "zstd" :
226219 builder = builder .withCodecs (c -> c .withZstd (0 ));
@@ -440,7 +433,7 @@ public void testV3ArrayMetadataBuilder() throws ZarrException {
440433 .withChunkShape (1 , 1024 , 1024 , 1024 )
441434 .withFillValue (0 )
442435 .withCodecs (
443- c -> c .withSharding (new int []{1 , 32 , 32 , 32 }, c1 -> c1 . withBlosc () ))
436+ c -> c .withSharding (new int []{1 , 32 , 32 , 32 }, CodecBuilder :: withBlosc ))
444437 .build ();
445438 }
446439
@@ -470,12 +463,11 @@ public void testV3Group() throws IOException, ZarrException {
470463 }
471464
472465 @ Test
473- public void testV2 () throws IOException , ZarrException {
466+ public void testV2 () throws IOException {
474467 FilesystemStore fsStore = new FilesystemStore ("" );
475468 HttpStore httpStore = new HttpStore ("https://static.webknossos.org/data" );
476469
477- System .out .println (
478- dev .zarr .zarrjava .v2 .Array .open (httpStore .resolve ("l4_sample" , "color" , "1" )));
470+ System .out .println (dev .zarr .zarrjava .v2 .Array .open (httpStore .resolve ("l4_sample" , "color" , "1" )));
479471 }
480472
481473
0 commit comments