| | |
| | | import hdf.hdf5lib.exceptions.HDF5LibraryException; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | @Service |
| | | public class BizH5FileParserServiceImpl implements IBizH5FileParserService { |
| | | |
| | | |
| | | @Override |
| | | public long openH5File(String filePath) throws HDF5LibraryException { |
| | | long fileId = H5.H5Fopen(filePath, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); |
| | | return fileId; |
| | | public long openH5File(String filePath) { |
| | | int hdf5File = -1; |
| | | try { |
| | | hdf5File = H5.H5Fopen(filePath, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); |
| | | // 在这里进行文件操作 |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | if (hdf5File >= 0) { |
| | | try { |
| | | H5.H5Fclose(hdf5File); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | return hdf5File; |
| | | } |
| | | |
| | | @Override |