Skip to content
Snippets Groups Projects
Commit 1e405316 authored by brinn's avatar brinn
Browse files

fix: revert last change, Closeable _is_ needed

SVN: 20887
parent 0280f79e
No related branches found
No related tags found
No related merge requests found
......@@ -16,8 +16,11 @@
package ch.systemsx.cisd.common.io;
import java.io.Closeable;
import java.io.File;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import ch.systemsx.cisd.base.io.AdapterIInputStreamToInputStream;
import ch.systemsx.cisd.base.io.IRandomAccessFile;
......@@ -31,7 +34,7 @@ import ch.systemsx.cisd.hdf5.io.HDF5DataSetRandomAccessFile;
*
* @author Bernd Rinn
*/
public class HDF5DataSetBasedContent implements IContent
public class HDF5DataSetBasedContent implements IContent, Closeable
{
private final File hdf5File;
......@@ -43,6 +46,8 @@ public class HDF5DataSetBasedContent implements IContent
private final long size;
private final List<HDF5DataSetRandomAccessFile> randomAccessFiles;
public HDF5DataSetBasedContent(File hdf5File, String dataSetPath)
{
this.hdf5File = hdf5File;
......@@ -59,6 +64,7 @@ public class HDF5DataSetBasedContent implements IContent
this.size = 0L;
}
reader.close();
this.randomAccessFiles = new ArrayList<HDF5DataSetRandomAccessFile>();
}
public String tryGetName()
......@@ -80,6 +86,7 @@ public class HDF5DataSetBasedContent implements IContent
{
final HDF5DataSetRandomAccessFile randomAccessFile =
HDF5DataSetRandomAccessFile.createForReading(hdf5File, dataSetPath);
randomAccessFiles.add(randomAccessFile);
return randomAccessFile;
}
......@@ -88,4 +95,12 @@ public class HDF5DataSetBasedContent implements IContent
return new AdapterIInputStreamToInputStream(getReadOnlyRandomAccessFile());
}
public void close()
{
for (HDF5DataSetRandomAccessFile raFile : randomAccessFiles)
{
raFile.close();
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment