public void addCramRecords(final Iterable<CramCompressionRecord> records) { for (final CramCompressionRecord record : records) add(record); }
private static String toHexString(final byte[] bytes) { return toHex(bytes).replace(" ", ""); }
public static ContentDigests create(final EnumSet<KNOWN_DIGESTS> requestedDigests) { final List<Digester> digesters = new LinkedList<ContentDigests.Digester>(); for (final KNOWN_DIGESTS digest : requestedDigests) digesters.add(digest.createDigester()); return new ContentDigests(digesters); }
public boolean test(final SAMBinaryTagAndValue tags) { for (final Digester digester : digesters) { final SAMBinaryTagAndValue foundTag = tags.find(digester.tagCode); if (foundTag == null) continue; if (!(foundTag.value instanceof byte[])) throw new RuntimeException("Expecting a byte array but got: " + foundTag.value.getClass().getName()); final byte[] expected = (byte[]) foundTag.value; final byte[] actual = digester.digest.asByteArray(); if (!Arrays.equals(expected, actual)) { final String expectedString = toHexString(expected); final String actualString = toHexString(actual); log.error(String .format("Content hash mismatch for tag %s, actual: %s; expected: %s", digester.tagID, actualString, expectedString)); return false; } else log.debug("Content digest ok: " + digester.tagID); } return true; }
public static ContentDigests create(final EnumSet<KNOWN_DIGESTS> requestedDigests) { final List<Digester> digesters = new LinkedList<ContentDigests.Digester>(); for (final KNOWN_DIGESTS digest : requestedDigests) digesters.add(digest.createDigester()); return new ContentDigests(digesters); }
public boolean test(final SAMBinaryTagAndValue tags) { for (final Digester digester : digesters) { final SAMBinaryTagAndValue foundTag = tags.find(digester.tagCode); if (foundTag == null) continue; if (!(foundTag.value instanceof byte[])) throw new RuntimeException("Expecting a byte array but got: " + foundTag.value.getClass().getName()); final byte[] expected = (byte[]) foundTag.value; final byte[] actual = digester.digest.asByteArray(); if (!Arrays.equals(expected, actual)) { final String expectedString = toHexString(expected); final String actualString = toHexString(actual); log.error(String .format("Content hash mismatch for tag %s, actual: %s; expected: %s", digester.tagID, actualString, expectedString)); return false; } else log.debug("Content digest ok: " + digester.tagID); } return true; }
public static ContentDigests create(final SAMBinaryTagAndValue binaryTags) { final List<Digester> digesters = new LinkedList<ContentDigests.Digester>(); SAMBinaryTagAndValue binaryTag = binaryTags; while (binaryTag != null) { final String tagID = SAMTag.makeStringTag( binaryTag.tag); final KNOWN_DIGESTS hash; try { hash = KNOWN_DIGESTS.valueOf(tagID); digesters.add(hash.createDigester()); } catch (final IllegalArgumentException e) { // The tag is not one of the known content digest tags. } binaryTag = binaryTag.getNext(); } return new ContentDigests(digesters); }
public void addSAMRecords(final Iterable<SAMRecord> records) { for (final SAMRecord record : records) add(record); }
private static String toHexString(final byte[] bytes) { return toHex(bytes).replace(" ", ""); }
public static ContentDigests create(final SAMBinaryTagAndValue binaryTags) { final List<Digester> digesters = new LinkedList<ContentDigests.Digester>(); SAMBinaryTagAndValue binaryTag = binaryTags; while (binaryTag != null) { final String tagID = SAMTag.makeStringTag( binaryTag.tag); final KNOWN_DIGESTS hash; try { hash = KNOWN_DIGESTS.valueOf(tagID); digesters.add(hash.createDigester()); } catch (final IllegalArgumentException e) { // The tag is not one of the known content digest tags. } binaryTag = binaryTag.getNext(); } return new ContentDigests(digesters); }
public void addCramRecords(final Iterable<CramCompressionRecord> records) { for (final CramCompressionRecord record : records) add(record); }
public void addSAMRecords(final Iterable<SAMRecord> records) { for (final SAMRecord record : records) add(record); }