/// <exception cref="System.IO.IOException"/> public void CommitSection(FsImageProto.FileSummary.Builder summary, FSImageFormatProtobuf.SectionName name) { long oldOffset = currentOffset; FlushSectionOutputStream(); if (codec != null) { sectionOutputStream = codec.CreateOutputStream(underlyingOutputStream); } else { sectionOutputStream = underlyingOutputStream; } long length = fileChannel.Position() - oldOffset; summary.AddSections(FsImageProto.FileSummary.Section.NewBuilder().SetName(name.name ).SetLength(length).SetOffset(currentOffset)); currentOffset += length; }
public int Compare(FsImageProto.FileSummary.Section s1, FsImageProto.FileSummary.Section s2) { FSImageFormatProtobuf.SectionName n1 = FSImageFormatProtobuf.SectionName.FromString (s1.GetName()); FSImageFormatProtobuf.SectionName n2 = FSImageFormatProtobuf.SectionName.FromString (s2.GetName()); if (n1 == null) { return(n2 == null ? 0 : -1); } else { if (n2 == null) { return(-1); } else { return((int)(n1) - (int)(n2)); } } }