/** * Check if the file: 1) contains proper CRAM header. 2) given the version info from the header check the end of file marker. * * @param file the CRAM file to check * @return true if the file is a valid CRAM file and is properly terminated with respect to the version. * @throws IOException as per java IO contract */ public static boolean checkHeaderAndEOF(final File file) throws IOException { final SeekableStream seekableStream = new SeekableFileStream(file); final CramHeader cramHeader = readCramHeader(seekableStream); return checkEOF(cramHeader.getVersion(), seekableStream); }
/** * Check if the file: 1) contains proper CRAM header. 2) given the version info from the header check the end of file marker. * * @param file the CRAM file to check * @return true if the file is a valid CRAM file and is properly terminated with respect to the version. */ public static boolean checkHeaderAndEOF(final File file) { try (final SeekableStream seekableStream = new SeekableFileStream(file)) { final CramHeader cramHeader = readCramHeader(seekableStream); return checkEOF(cramHeader.getVersion(), seekableStream); } catch (final IOException e) { throw new RuntimeIOException(e); } }