We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5a8340d commit 5f37ae6Copy full SHA for 5f37ae6
1 file changed
src/main/java/org/janelia/saalfeldlab/n5/BufferedKvaLockedChannel.java
@@ -1,6 +1,8 @@
1
package org.janelia.saalfeldlab.n5;
2
3
+import org.apache.commons.io.input.ProxyInputStream;
4
import org.janelia.saalfeldlab.n5.readdata.ReadData;
5
+import org.janelia.saalfeldlab.n5.readdata.VolatileReadData;
6
7
import java.io.*;
8
@@ -23,7 +25,15 @@ public Reader newReader() throws N5Exception.N5IOException {
23
25
24
26
@Override
27
public InputStream newInputStream() throws N5Exception.N5IOException {
- return kva.createReadData(key).inputStream();
28
+
29
+ VolatileReadData volatileReadData = kva.createReadData(key);
30
+ return new ProxyInputStream(volatileReadData.inputStream()) {
31
+ @Override
32
+ public void close() throws IOException {
33
+ volatileReadData.close();
34
+ super.close();
35
+ }
36
+ };
37
}
38
39
0 commit comments