Skip to content

Commit 29541d5

Browse files
committed
remove unused method
1 parent 554715f commit 29541d5

File tree

2 files changed

+10
-29
lines changed

2 files changed

+10
-29
lines changed

src/main/java/dev/zarr/zarrjava/v3/codec/core/ZstdCodec.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
import dev.zarr.zarrjava.v3.codec.BytesBytesCodec;
1010

1111
import javax.annotation.Nonnull;
12-
import java.io.IOException;
13-
import java.io.InputStream;
14-
import java.io.OutputStream;
1512
import java.nio.ByteBuffer;
1613

1714
public class ZstdCodec extends BytesBytesCodec {
@@ -26,14 +23,6 @@ public ZstdCodec(
2623
this.configuration = configuration;
2724
}
2825

29-
private void copy(InputStream inputStream, OutputStream outputStream) throws IOException {
30-
byte[] buffer = new byte[4096];
31-
int len;
32-
while ((len = inputStream.read(buffer)) > 0) {
33-
outputStream.write(buffer, 0, len);
34-
}
35-
}
36-
3726
@Override
3827
public ByteBuffer decode(ByteBuffer compressedBytes) throws ZarrException {
3928
byte[] compressedArray = compressedBytes.array();

src/test/java/dev/zarr/zarrjava/ZarrTest.java

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import dev.zarr.zarrjava.store.StoreHandle;
1313
import dev.zarr.zarrjava.utils.MultiArrayUtils;
1414
import dev.zarr.zarrjava.v3.*;
15+
import dev.zarr.zarrjava.v3.codec.CodecBuilder;
1516
import dev.zarr.zarrjava.v3.codec.core.TransposeCodec;
1617
import org.junit.jupiter.api.Assertions;
1718
import 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

Comments
 (0)