Skip to content

Commit

Permalink
Merge pull request bcdev#2 from melissalinkert/dimensionseparator-getter
Browse files Browse the repository at this point in the history
ZarrArray: add a method to get the `DimensionSeparator`
  • Loading branch information
joshmoore authored May 22, 2023
2 parents 2cde269 + 5b421dd commit f16b2e5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
9 changes: 9 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,14 @@
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<includes>**/*.java</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
Expand Down Expand Up @@ -286,6 +294,7 @@
<configuration>
<argLine>-Djna.library.path=${bloscJnaLibraryPath}</argLine>
<systemPropertiesFile>${basedir}/blosc.properties</systemPropertiesFile>
<includes>**/*.java</includes>
</configuration>
</plugin>
</plugins>
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/bc/zarr/ZarrArray.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ public ByteOrder getByteOrder() {
return _byteOrder;
}

public DimensionSeparator getDimensionSeparator() {
return _separator;
}

public void write(Number value) throws IOException, InvalidRangeException {
final int[] shape = getShape();
final int[] offset = new int[shape.length];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,8 @@ public void tearDown() throws Exception {
@Test
public void openOldStyleZarrArrayAndDetectDimensionSeparator() throws IOException, NoSuchFieldException, IllegalAccessException {
final ZarrArray array = ZarrArray.open(arrayPath);
final Object separator = TestUtils.getPrivateFieldObject(array, "_separator");
assertThat(separator)
.isNotNull()
.isInstanceOf(DimensionSeparator.class);
DimensionSeparator sep = (DimensionSeparator) separator;
DimensionSeparator sep = array.getDimensionSeparator();
assertThat(sep).isNotNull();
assertThat(sep.getSeparatorChar()).isEqualTo("/");
}

Expand All @@ -104,4 +101,4 @@ private void prepareOldStyleArrayHeaderFile(FileSystemStore store) throws IOExce
final OutputStream os = store.getOutputStream(".zarray");
TestUtils.deleteLineContaining("dimension_separator", is, os);
}
}
}

0 comments on commit f16b2e5

Please sign in to comment.