Skip to content

Commit 3d83479

Browse files
committed
fix: partial code when migrating to ReadData for GsonUtils.readAttributes
1 parent 503e287 commit 3d83479

1 file changed

Lines changed: 2 additions & 11 deletions

File tree

src/main/java/org/janelia/saalfeldlab/n5/GsonKeyValueN5Reader.java

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030

3131
import java.io.IOException;
3232
import java.io.InputStream;
33+
import java.io.InputStreamReader;
3334
import java.io.UncheckedIOException;
34-
import java.util.Arrays;
3535

3636
import org.janelia.saalfeldlab.n5.N5Exception.N5IOException;
3737
import org.janelia.saalfeldlab.n5.codec.Codec.ArrayCodec;
@@ -83,21 +83,12 @@ default JsonElement getAttributes(final String pathName) throws N5Exception {
8383
final String attributesPath = absoluteAttributesPath(groupPath);
8484

8585
try ( final InputStream in = getKeyValueAccess().createReadData(attributesPath).inputStream() ) {
86-
GsonUtils.readAttributes()
86+
return GsonUtils.readAttributes(new InputStreamReader(in), getGson());
8787
} catch (final N5Exception.N5NoSuchKeyException e) {
8888
return null;
8989
} catch (final IOException | UncheckedIOException | N5IOException e) {
9090
throw new N5IOException("Failed to read attributes from dataset " + pathName, e);
9191
}
92-
93-
try (final LockedChannel lockedChannel = getKeyValueAccess().lockForReading(attributesPath)) {
94-
return GsonUtils.readAttributes(lockedChannel.newReader(), getGson());
95-
} catch (final N5Exception.N5NoSuchKeyException e) {
96-
return null;
97-
} catch (final IOException | UncheckedIOException | N5IOException e) {
98-
throw new N5IOException("Failed to read attributes from dataset " + pathName, e);
99-
}
100-
10192
}
10293

10394
@Override

0 commit comments

Comments
 (0)