public void commitSection(FileSummary.Builder summary, SectionName name) throws IOException { long oldOffset = currentOffset; flushSectionOutputStream(); if (codec != null) { sectionOutputStream = codec.createOutputStream(underlyingOutputStream); } else { sectionOutputStream = underlyingOutputStream; } long length = fileChannel.position() - oldOffset; summary.addSections(FileSummary.Section.newBuilder().setName(name.name) .setLength(length).setOffset(currentOffset)); currentOffset += length; }
public void commitSection(FileSummary.Builder summary, SectionName name) throws IOException { long oldOffset = currentOffset; flushSectionOutputStream(); if (codec != null) { sectionOutputStream = codec.createOutputStream(underlyingOutputStream); } else { sectionOutputStream = underlyingOutputStream; } long length = fileChannel.position() - oldOffset; summary.addSections(FileSummary.Section.newBuilder().setName(name.name) .setLength(length).setOffset(currentOffset)); currentOffset += length; }
public void commitSection(FileSummary.Builder summary, SectionName name) throws IOException { long oldOffset = currentOffset; flushSectionOutputStream(); if (codec != null) { sectionOutputStream = codec.createOutputStream(underlyingOutputStream); } else { sectionOutputStream = underlyingOutputStream; } long length = fileChannel.position() - oldOffset; summary.addSections(FileSummary.Section.newBuilder().setName(name.name) .setLength(length).setOffset(currentOffset)); currentOffset += length; }
void endSection(OutputStream out, SectionName name) throws IOException { CompressionCodec codec = compress.getImageCodec(); if (codec != null) { ((CompressorStream)out).finish(); } out.flush(); long length = raw.pos - curSec; summary.addSections(FileSummary.Section.newBuilder() .setName(name.toString()) // not strictly correct, but name not visible .setOffset(curSec).setLength(length)); curSec += length; }
/** * Record the length of a section of the FSImage in our FileSummary object. * The FileSummary appears at the end of the FSImage and acts as a table of * contents for the file. * * @param sectionNamePb The name of the section as it should appear in * the fsimage. (This is different than the XML * name.) * @throws IOException */ void recordSectionLength(String sectionNamePb) throws IOException { long curSectionStartOffset = sectionStartOffset; long curPos = out.getCount(); //if (sectionNamePb.equals(SectionName.STRING_TABLE.name())) { fileSummaryBld.addSections(FileSummary.Section.newBuilder(). setName(sectionNamePb). setLength(curPos - curSectionStartOffset). setOffset(curSectionStartOffset)); //} sectionStartOffset = curPos; }