use of htsjdk.samtools.util.BlockCompressedInputStream in project jvarkit by lindenb.
the class FindCorruptedFiles method testVcf.
private void testVcf(File f) {
LOG.fine("Test VCF for " + f);
Exception error1 = null;
BlockCompressedInputStream in1 = null;
try {
in1 = new BlockCompressedInputStream(f);
testVcf(f, in1);
} catch (Exception err) {
error1 = err;
} finally {
if (in1 != null)
try {
in1.close();
in1 = null;
} catch (IOException e) {
}
}
if (error1 == null) {
try {
BlockCompressedInputStream.FileTermination type = BlockCompressedInputStream.checkTermination(f);
if (type != BlockCompressedInputStream.FileTermination.HAS_TERMINATOR_BLOCK) {
LOG.warning("bgz:" + type + " for " + f);
stdout().println(f);
return;
}
} catch (Exception err) {
stdout().println(f);
return;
}
// TEST BGZF termination
return;
}
GZIPInputStream in2 = null;
try {
in2 = new GZIPInputStream(new FileInputStream(f));
testVcf(f, in2);
LOG.warning("gzip but not bgzip :" + f);
return;
} catch (Exception err) {
err.printStackTrace();
} finally {
if (in2 != null)
try {
in2.close();
} catch (IOException e) {
}
}
LOG.fine("Not a BGZIP file / Error in VCF: " + f);
stdout().println(f);
}
Aggregations