/** * Reads a CRAM container from the input stream. Returns an EOF container when there is no more data or the EOF marker found. * * @param version CRAM version to expect * @param inputStream the stream to read from * @return a new container object read from the stream */ public static Container readContainer(final Version version, final InputStream inputStream) { final Container container = readContainer(version.major, inputStream); if (container == null) { // this will cause System.exit(1): CramVersionPolicies.eofNotFound(version); return readContainer(version.major, new ByteArrayInputStream(CramIO.ZERO_B_EOF_MARKER)); } if (container.isEOF()) log.debug("EOF marker found, file/stream is complete."); return container; }
/** * Reads a CRAM container from the input stream. Returns an EOF container when there is no more data or the EOF marker found. * * @param version CRAM version to expect * @param inputStream the stream to read from * @return a new container object read from the stream * @throws IOException as per java IO contract */ public static Container readContainer(final Version version, final InputStream inputStream) throws IOException { final Container container = readContainer(version.major, inputStream); if (container == null) { // this will cause System.exit(1): CramVersionPolicies.eofNotFound(version); return readContainer(version.major, new ByteArrayInputStream(CramIO.ZERO_B_EOF_MARKER)); } if (container.isEOF()) log.debug("EOF marker found, file/stream is complete."); return container; }