Interface DataFile
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
AbstractDataFile, FITSFile
Represents a scientific data file (e.g., FITS, HDF5, NetCDF).
This interface provides a unified way to access metadata and data blocks within a structured scientific file. Implementations leverage Java NIO.2 for efficient I/O operations.
- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes this file and releases any system resources associated with it.Returns the underlying byte channel for this file.Returns a description of the file format version or standard (e.g.getPath()Returns the path to this file.voidopen(OpenOption... options) Opens this file with the specified options.
-
Method Details
-
getPath
Path getPath()Returns the path to this file.- Returns:
- the file path, or
nullif this is an in-memory or stream-based file.
-
open
Opens this file with the specified options.- Parameters:
options- the options specifying how the file is opened- Throws:
IOException- if an I/O error occurs
-
getChannel
SeekableByteChannel getChannel()Returns the underlying byte channel for this file.This allows direct low-level access if needed, though usually standard read/write methods should be preferred.
- Returns:
- the byte channel, or
nullif not open.
-
close
Closes this file and releases any system resources associated with it.- Specified by:
closein interfaceAutoCloseable- Throws:
IOException- if an I/O error occurs
-
getFormatDescription
String getFormatDescription()Returns a description of the file format version or standard (e.g. "FITS 4.0").- Returns:
- the format description.
-