Skip to content

Commit

Permalink
remove unused method
Browse files Browse the repository at this point in the history
  • Loading branch information
brokkoli71 committed May 30, 2024
1 parent 554715f commit 29541d5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 29 deletions.
11 changes: 0 additions & 11 deletions src/main/java/dev/zarr/zarrjava/v3/codec/core/ZstdCodec.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
import dev.zarr.zarrjava.v3.codec.BytesBytesCodec;

import javax.annotation.Nonnull;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.ByteBuffer;

public class ZstdCodec extends BytesBytesCodec {
Expand All @@ -26,14 +23,6 @@ public ZstdCodec(
this.configuration = configuration;
}

private void copy(InputStream inputStream, OutputStream outputStream) throws IOException {
byte[] buffer = new byte[4096];
int len;
while ((len = inputStream.read(buffer)) > 0) {
outputStream.write(buffer, 0, len);
}
}

@Override
public ByteBuffer decode(ByteBuffer compressedBytes) throws ZarrException {
byte[] compressedArray = compressedBytes.array();
Expand Down
28 changes: 10 additions & 18 deletions src/test/java/dev/zarr/zarrjava/ZarrTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import dev.zarr.zarrjava.store.StoreHandle;
import dev.zarr.zarrjava.utils.MultiArrayUtils;
import dev.zarr.zarrjava.v3.*;
import dev.zarr.zarrjava.v3.codec.CodecBuilder;
import dev.zarr.zarrjava.v3.codec.core.TransposeCodec;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
Expand Down Expand Up @@ -92,17 +93,9 @@ public void testReadFromZarrita(String codec) throws IOException, ZarrException,
Assertions.assertArrayEquals(expectedData, (int[]) result.get1DJavaArray(ucar.ma2.DataType.INT));
}

private void copy(InputStream inputStream, OutputStream outputStream) throws IOException {
byte[] buffer = new byte[4096];
int len;
while ((len = inputStream.read(buffer)) > 0) {
outputStream.write(buffer, 0, len);
}
}

@CsvSource({"0,true", "0,false", "5, true", "10, false"})
@ParameterizedTest
public void testZstdLibrary(int clevel, boolean checksumFlag) throws IOException, InterruptedException, ZarrException {
public void testZstdLibrary(int clevel, boolean checksumFlag) throws IOException, InterruptedException {
//compress using ZstdCompressCtx
int number = 123456;
byte[] src = ByteBuffer.allocate(4).putInt(number).array();
Expand Down Expand Up @@ -147,10 +140,10 @@ public void testWriteToZarrita(String codec) throws IOException, ZarrException,

switch (codec) {
case "blosc":
builder = builder.withCodecs(c -> c.withBlosc());
builder = builder.withCodecs(CodecBuilder::withBlosc);
break;
case "gzip":
builder = builder.withCodecs(c -> c.withGzip());
builder = builder.withCodecs(CodecBuilder::withGzip);
break;
case "zstd":
builder = builder.withCodecs(c -> c.withZstd(0));
Expand Down Expand Up @@ -203,7 +196,7 @@ public void testWriteToZarrita(String codec) throws IOException, ZarrException,

@ParameterizedTest
@ValueSource(strings = {"blosc", "gzip", "zstd", "bytes", "transpose", "sharding_start", "sharding_end"})
public void testCodecsWriteRead(String codec) throws IOException, ZarrException, InterruptedException {
public void testCodecsWriteRead(String codec) throws IOException, ZarrException {
int[] testData = new int[16 * 16 * 16];
Arrays.setAll(testData, p -> p);

Expand All @@ -217,10 +210,10 @@ public void testCodecsWriteRead(String codec) throws IOException, ZarrException,

switch (codec) {
case "blosc":
builder = builder.withCodecs(c -> c.withBlosc());
builder = builder.withCodecs(CodecBuilder::withBlosc);
break;
case "gzip":
builder = builder.withCodecs(c -> c.withGzip());
builder = builder.withCodecs(CodecBuilder::withGzip);
break;
case "zstd":
builder = builder.withCodecs(c -> c.withZstd(0));
Expand Down Expand Up @@ -440,7 +433,7 @@ public void testV3ArrayMetadataBuilder() throws ZarrException {
.withChunkShape(1, 1024, 1024, 1024)
.withFillValue(0)
.withCodecs(
c -> c.withSharding(new int[]{1, 32, 32, 32}, c1 -> c1.withBlosc()))
c -> c.withSharding(new int[]{1, 32, 32, 32}, CodecBuilder::withBlosc))
.build();
}

Expand Down Expand Up @@ -470,12 +463,11 @@ public void testV3Group() throws IOException, ZarrException {
}

@Test
public void testV2() throws IOException, ZarrException {
public void testV2() throws IOException{
FilesystemStore fsStore = new FilesystemStore("");
HttpStore httpStore = new HttpStore("https://static.webknossos.org/data");

System.out.println(
dev.zarr.zarrjava.v2.Array.open(httpStore.resolve("l4_sample", "color", "1")));
System.out.println(dev.zarr.zarrjava.v2.Array.open(httpStore.resolve("l4_sample", "color", "1")));
}


Expand Down

0 comments on commit 29541d5

Please sign in to comment.