File tree Expand file tree Collapse file tree
src/main/java/org/janelia/saalfeldlab/n5 Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3030
3131import java .io .IOException ;
3232import java .io .InputStream ;
33+ import java .io .InputStreamReader ;
3334import java .io .UncheckedIOException ;
34- import java .util .Arrays ;
3535
3636import org .janelia .saalfeldlab .n5 .N5Exception .N5IOException ;
3737import 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
You can’t perform that action at this time.
0 commit comments