/** * Use this when writing to a stream and you want to use the pb mergeDelimitedFrom * (w/o the delimiter, pb reads to EOF which may not be what you want). * @return This instance serialized as a delimited protobuf w/ a magic pb prefix. * @throws IOException */ byte [] toByteArray() throws IOException { return ProtobufUtil.prependPBMagic(convert().toByteArray()); }
if (ProtobufUtil.isPBMagicPrefix(pbuf)) return convert(FSProtos.Reference.parseFrom(in));
Reference reference = Reference.convert(storeFile.getReference()); reference.write(fs, outPath); } else {
@Override public void storeFile(final SnapshotRegionManifest.Builder region, final SnapshotRegionManifest.FamilyFiles.Builder family, final StoreFileInfo storeFile) throws IOException { SnapshotRegionManifest.StoreFile.Builder sfManifest = SnapshotRegionManifest.StoreFile.newBuilder(); sfManifest.setName(storeFile.getPath().getName()); if (storeFile.isReference()) { sfManifest.setReference(storeFile.getReference().convert()); } sfManifest.setFileSize(storeFile.getReferencedFileStatus(rootFs).getLen()); family.addStoreFiles(sfManifest.build()); } }
/** * Use this when writing to a stream and you want to use the pb mergeDelimitedFrom * (w/o the delimiter, pb reads to EOF which may not be what you want). * @return This instance serialized as a delimited protobuf w/ a magic pb prefix. * @throws IOException */ byte [] toByteArray() throws IOException { return ProtobufUtil.prependPBMagic(convert().toByteArray()); }
if (read != pblen) throw new IOException("read=" + read + ", wanted=" + pblen); if (ProtobufUtil.isPBMagicPrefix(pbuf)) return convert(FSProtos.Reference.parseFrom(in));
Reference reference = Reference.convert(storeFile.getReference()); reference.write(fs, outPath); } else {
public void storeFile(final SnapshotRegionManifest.Builder region, final SnapshotRegionManifest.FamilyFiles.Builder family, final StoreFileInfo storeFile) throws IOException { SnapshotRegionManifest.StoreFile.Builder sfManifest = SnapshotRegionManifest.StoreFile.newBuilder(); sfManifest.setName(storeFile.getPath().getName()); if (storeFile.isReference()) { sfManifest.setReference(storeFile.getReference().convert()); } sfManifest.setFileSize(storeFile.getReferencedFileStatus(fs).getLen()); family.addStoreFiles(sfManifest.build()); } }