Skip to content

Commit

Permalink
Rename ZarrCompatibleStringDataBlock
Browse files Browse the repository at this point in the history
  • Loading branch information
minnerbe committed Oct 21, 2023
1 parent 970b6e3 commit 395bf3f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/main/java/org/janelia/saalfeldlab/n5/zarr/DType.java
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public DType(final String typestr, final Collection<Filter> filters) {
nBits = 0;
if (filters.contains(VLEN_UTF8)) {
dataBlockFactory = (blockSize, gridPosition, numElements) ->
new ZarrCompatibleStringDataBlock(blockSize, gridPosition, new String[0]);
new ZarrStringDataBlock(blockSize, gridPosition, new String[0]);
byteBlockFactory = (blockSize, gridPosition, numElements) ->
new ByteArrayDataBlock(blockSize, gridPosition, new byte[numElements * nBytes]);
} else {
Expand Down Expand Up @@ -281,7 +281,7 @@ public DType(final DataType dataType, final int nPrimitives) {
case STRING:
nBytes = 1;
dataBlockFactory = (blockSize, gridPosition, numElements) ->
new ZarrCompatibleStringDataBlock(blockSize, gridPosition, new String[0]);
new ZarrStringDataBlock(blockSize, gridPosition, new String[0]);
break;
default:
nBytes = nPrimitives;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -685,9 +685,9 @@ protected static DataBlock<?> readBlock(
return dataBlock;
}

private static ZarrCompatibleStringDataBlock readVLenStringBlock(InputStream in, BlockReader reader, ByteArrayDataBlock byteBlock) throws IOException {
private static ZarrStringDataBlock readVLenStringBlock(InputStream in, BlockReader reader, ByteArrayDataBlock byteBlock) throws IOException {
// read whole chunk and deserialize; this should be improved
ZarrCompatibleStringDataBlock dataBlock = new ZarrCompatibleStringDataBlock(byteBlock.getSize(), byteBlock.getGridPosition(), new String[0]);
ZarrStringDataBlock dataBlock = new ZarrStringDataBlock(byteBlock.getSize(), byteBlock.getGridPosition(), new String[0]);
if (reader instanceof BloscCompression) {
// Blosc reader reads actual data and doesn't care about buffer size (but needs special treatment in data block)
reader.read(dataBlock, in);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
import java.nio.ByteOrder;
import java.util.Arrays;

public class ZarrCompatibleStringDataBlock extends StringDataBlock {
public class ZarrStringDataBlock extends StringDataBlock {

public ZarrCompatibleStringDataBlock(int[] size, long[] gridPosition, String[] data) {
public ZarrStringDataBlock(int[] size, long[] gridPosition, String[] data) {
super(size, gridPosition, data);
}

public ZarrCompatibleStringDataBlock(int[] size, long[] gridPosition, byte[] data) {
public ZarrStringDataBlock(int[] size, long[] gridPosition, byte[] data) {
super(size, gridPosition, data);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ public void testWriteReadStringBlock() {
try (final N5Writer n5 = createN5Writer()) {
n5.createDataset("/test/group/dataset", dimensions, blockSize, dataType, compression);
DatasetAttributes attributes = n5.getDatasetAttributes("/test/group/dataset");
StringDataBlock dataBlock = new ZarrCompatibleStringDataBlock(blockSize, new long[]{0L, 0L, 0L}, stringBlock);
StringDataBlock dataBlock = new ZarrStringDataBlock(blockSize, new long[]{0L, 0L, 0L}, stringBlock);
n5.writeBlock("/test/group/dataset", attributes, dataBlock);
DataBlock<?> loadedDataBlock = n5.readBlock("/test/group/dataset", attributes, 0L, 0L, 0L);
assertArrayEquals(stringBlock, (String[])loadedDataBlock.getData());
Expand Down

0 comments on commit 395bf3f

Please sign in to comment.