/** * Load the names if they haven't already been loaded. * * @throws IOException if an I/O related error occurs */ private void loadNames() throws IOException { mNames = new PrereadNames(mDirectory, mRegion, false); if (mIndexFile.getVersion() >= IndexFile.SEPARATE_CHECKSUM_VERSION && mRegion.getStart() == 0 && mRegion.getEnd() == mIndexFile.getNumberSequences()) { if (mNames.calcChecksum() != mIndexFile.getNameChecksum()) { throw new CorruptSdfException( "Sequence names failed checksum - SDF may be corrupt: \"" + mDirectory + "\""); } else { Diagnostic.developerLog("Sequence names passed checksum"); } } }
private void loadNameSuffixes(boolean attemptLoad, boolean suffixExists) throws IOException { mNameSuffixes = attemptLoad && suffixExists ? new PrereadNames(mDirectory, mRegion, true) : new EmptyStringPrereadNames(mEnd - mStart); if (attemptLoad && suffixExists) { if (mRegion.getStart() == 0 && mRegion.getEnd() == mIndexFile.getNumberSequences()) { if (mNameSuffixes.calcChecksum() != mIndexFile.getNameSuffixChecksum()) { throw new CorruptSdfException( "Sequence name suffixes failed checksum - SDF may be corrupt: \"" + mDirectory + "\""); } else { Diagnostic.developerLog("Sequence name suffixes passed checksum"); } } } }
void infoString(final StringBuilder sb) { sb.append("Memory Usage: ").append(mNumberSequences).append(" sequences").append(LS); long totalBytes = mData.infoString(sb); if (mNames != null) { sb.append("\t\t") .append(StringUtils.commas(mNames.bytes())) .append("\t") .append(StringUtils.commas(mNames.length())) .append("\tNames") .append(LS); totalBytes += mNames.bytes(); } if (mNameSuffixes != null) { sb.append("\t\t") .append(StringUtils.commas(mNameSuffixes.bytes())) .append("\t") .append(StringUtils.commas(mNameSuffixes.length())) .append("\tSuffixes") .append(LS); totalBytes += mNameSuffixes.bytes(); } sb.append("\t\t").append(StringUtils.commas(totalBytes)).append("\t\tTotal bytes").append(LS); }
@Override public String nameSuffix(long sequenceIndex) { return mNameSuffixes.name(sequenceIndex); }