PBHelper { public static LocatedBlockProto[] convertLocatedBlock(LocatedBlock[] lb) { if (lb == null) return null; return convertLocatedBlock2(Arrays.asList(lb)).toArray( new LocatedBlockProto[lb.length]); } private  PBHelper(); static ByteString getByteString(byte[] bytes); static NamenodeRole convert(NamenodeRoleProto role); static NamenodeRoleProto convert(NamenodeRole role); static StorageInfoProto convert(StorageInfo info); static StorageInfo convert(StorageInfoProto info, NodeType type); static NamenodeRegistrationProto convert(NamenodeRegistration reg); static NamenodeRegistration convert(NamenodeRegistrationProto reg); static DatanodeID convert(DatanodeIDProto dn); static DatanodeIDProto convert(DatanodeID dn); static DatanodeIDProto[] convert(DatanodeID[] did); static DatanodeID[] convert(DatanodeIDProto[] did); static BlockProto convert(Block b); static Block convert(BlockProto b); static BlockWithLocationsProto convert(BlockWithLocations blk); static BlockWithLocations convert(BlockWithLocationsProto b); static BlocksWithLocationsProto convert(BlocksWithLocations blks); static BlocksWithLocations convert(BlocksWithLocationsProto blocks); static BlockKeyProto convert(BlockKey key); static BlockKey convert(BlockKeyProto k); static ExportedBlockKeysProto convert(ExportedBlockKeys keys); static ExportedBlockKeys convert(ExportedBlockKeysProto keys); static CheckpointSignatureProto convert(CheckpointSignature s); static CheckpointSignature convert(CheckpointSignatureProto s); static RemoteEditLogProto convert(RemoteEditLog log); static RemoteEditLog convert(RemoteEditLogProto l); static RemoteEditLogManifestProto convert(
      RemoteEditLogManifest manifest); static RemoteEditLogManifest convert(
      RemoteEditLogManifestProto manifest); static CheckpointCommandProto convert(CheckpointCommand cmd); static NamenodeCommandProto convert(NamenodeCommand cmd); static BlockKey[] convertBlockKeys(List<BlockKeyProto> list); static NamespaceInfo convert(NamespaceInfoProto info); static NamenodeCommand convert(NamenodeCommandProto cmd); static ExtendedBlock convert(ExtendedBlockProto eb); static ExtendedBlockProto convert(final ExtendedBlock b); static RecoveringBlockProto convert(RecoveringBlock b); static RecoveringBlock convert(RecoveringBlockProto b); static DatanodeInfoProto.AdminState convert(
      final DatanodeInfo.AdminStates inAs); static DatanodeInfo convert(DatanodeInfoProto di); static DatanodeInfoProto convertDatanodeInfo(DatanodeInfo di); static DatanodeInfo[] convert(DatanodeInfoProto di[]); static List<? extends HdfsProtos.DatanodeInfoProto> convert(
      DatanodeInfo[] dnInfos); static List<? extends HdfsProtos.DatanodeInfoProto> convert(
      DatanodeInfo[] dnInfos, int startIdx); static DatanodeInfo[] convert(List<DatanodeInfoProto> list); static DatanodeInfoProto convert(DatanodeInfo info); static ExtendedBlock[] convert(ExtendedBlockProto list[]); static List<? extends HdfsProtos.ExtendedBlockProto> convert(
      ExtendedBlock[] blks); static AdminStates convert(AdminState adminState); static LocatedBlockProto convert(LocatedBlock b); static LocatedBlock convert(LocatedBlockProto proto); static TokenProto convert(Token<?> tok); static Token<BlockTokenIdentifier> convert(
      TokenProto blockToken); static Token<DelegationTokenIdentifier> convertDelegationToken(
      TokenProto blockToken); static ReplicaState convert(ReplicaStateProto state); static ReplicaStateProto convert(ReplicaState state); static DatanodeRegistrationProto convert(
      DatanodeRegistration registration); static DatanodeRegistration convert(DatanodeRegistrationProto proto); static DatanodeCommand convert(DatanodeCommandProto proto); static BalancerBandwidthCommandProto convert(
      BalancerBandwidthCommand bbCmd); static KeyUpdateCommandProto convert(KeyUpdateCommand cmd); static BlockRecoveryCommandProto convert(BlockRecoveryCommand cmd); static FinalizeCommandProto convert(FinalizeCommand cmd); static BlockCommandProto convert(BlockCommand cmd); static BlockIdCommandProto convert(BlockIdCommand cmd); static DatanodeCommandProto convert(DatanodeCommand datanodeCommand); static KeyUpdateCommand convert(KeyUpdateCommandProto keyUpdateCmd); static FinalizeCommand convert(FinalizeCommandProto finalizeCmd); static BlockRecoveryCommand convert(
      BlockRecoveryCommandProto recoveryCmd); static BlockCommand convert(BlockCommandProto blkCmd); static BlockIdCommand convert(BlockIdCommandProto blkIdCmd); static DatanodeInfo[] convert(DatanodeInfosProto datanodeInfosProto); static BalancerBandwidthCommand convert(
      BalancerBandwidthCommandProto balancerCmd); static ReceivedDeletedBlockInfoProto convert(
      ReceivedDeletedBlockInfo receivedDeletedBlockInfo); static ReceivedDeletedBlockInfo convert(
      ReceivedDeletedBlockInfoProto proto); static NamespaceInfoProto convert(NamespaceInfo info); static LocatedBlockProto[] convertLocatedBlock(LocatedBlock[] lb); static LocatedBlock[] convertLocatedBlock(LocatedBlockProto[] lb); static List<LocatedBlock> convertLocatedBlock(
      List<LocatedBlockProto> lb); static List<LocatedBlockProto> convertLocatedBlock2(List<LocatedBlock> lb); static LocatedBlocks convert(LocatedBlocksProto lb); static LocatedBlocksProto convert(LocatedBlocks lb); static DataEncryptionKey convert(DataEncryptionKeyProto bet); static DataEncryptionKeyProto convert(DataEncryptionKey bet); static FsServerDefaults convert(FsServerDefaultsProto fs); static FsServerDefaultsProto convert(FsServerDefaults fs); static FsPermissionProto convert(FsPermission p); static FsPermission convert(FsPermissionProto p); static int convertCreateFlag(EnumSetWritable<CreateFlag> flag); static EnumSetWritable<CreateFlag> convertCreateFlag(int flag); static int convertCacheFlags(EnumSet<CacheFlag> flags); static EnumSet<CacheFlag> convertCacheFlags(int flags); static HdfsFileStatus convert(HdfsFileStatusProto fs); static SnapshottableDirectoryStatus convert(
      SnapshottableDirectoryStatusProto sdirStatusProto); static HdfsFileStatusProto convert(HdfsFileStatus fs); static SnapshottableDirectoryStatusProto convert(
      SnapshottableDirectoryStatus status); static HdfsFileStatusProto[] convert(HdfsFileStatus[] fs); static HdfsFileStatus[] convert(HdfsFileStatusProto[] fs); static DirectoryListing convert(DirectoryListingProto dl); static DirectoryListingProto convert(DirectoryListing d); static long[] convert(GetFsStatsResponseProto res); static GetFsStatsResponseProto convert(long[] fsStats); static DatanodeReportTypeProto convert(DatanodeReportType t); static DatanodeReportType convert(DatanodeReportTypeProto t); static SafeModeActionProto convert(
      SafeModeAction a); static SafeModeAction convert(
      ClientNamenodeProtocolProtos.SafeModeActionProto a); static RollingUpgradeActionProto convert(RollingUpgradeAction a); static RollingUpgradeAction convert(RollingUpgradeActionProto a); static RollingUpgradeStatusProto convertRollingUpgradeStatus(
      RollingUpgradeStatus status); static RollingUpgradeStatus convert(RollingUpgradeStatusProto proto); static RollingUpgradeInfoProto convert(RollingUpgradeInfo info); static RollingUpgradeInfo convert(RollingUpgradeInfoProto proto); static CorruptFileBlocks convert(CorruptFileBlocksProto c); static CorruptFileBlocksProto convert(CorruptFileBlocks c); static ContentSummary convert(ContentSummaryProto cs); static ContentSummaryProto convert(ContentSummary cs); static NNHAStatusHeartbeat convert(NNHAStatusHeartbeatProto s); static NNHAStatusHeartbeatProto convert(NNHAStatusHeartbeat hb); static DatanodeStorageProto convert(DatanodeStorage s); static DatanodeStorage convert(DatanodeStorageProto s); static StorageReportProto convert(StorageReport r); static StorageReport convert(StorageReportProto p); static StorageReport[] convertStorageReports(
      List<StorageReportProto> list); static JournalInfo convert(JournalInfoProto info); static JournalInfoProto convert(JournalInfo j); static SnapshottableDirectoryStatus[] convert(
      SnapshottableDirectoryListingProto sdlp); static SnapshottableDirectoryListingProto convert(
      SnapshottableDirectoryStatus[] status); static DiffReportEntry convert(SnapshotDiffReportEntryProto entry); static SnapshotDiffReportEntryProto convert(DiffReportEntry entry); static SnapshotDiffReport convert(SnapshotDiffReportProto reportProto); static SnapshotDiffReportProto convert(SnapshotDiffReport report); static DataChecksum.Type convert(HdfsProtos.ChecksumTypeProto type); static CacheDirectiveInfoProto convert(CacheDirectiveInfo info); static CacheDirectiveInfo convert(CacheDirectiveInfoProto proto); static CacheDirectiveInfoExpirationProto convert(
      CacheDirectiveInfo.Expiration expiration); static CacheDirectiveInfo.Expiration convert(
      CacheDirectiveInfoExpirationProto proto); static CacheDirectiveStatsProto convert(CacheDirectiveStats stats); static CacheDirectiveStats convert(CacheDirectiveStatsProto proto); static CacheDirectiveEntryProto convert(CacheDirectiveEntry entry); static CacheDirectiveEntry convert(CacheDirectiveEntryProto proto); static CachePoolInfoProto convert(CachePoolInfo info); static CachePoolInfo convert(CachePoolInfoProto proto); static CachePoolStatsProto convert(CachePoolStats stats); static CachePoolStats convert(CachePoolStatsProto proto); static CachePoolEntryProto convert(CachePoolEntry entry); static CachePoolEntry convert(CachePoolEntryProto proto); static HdfsProtos.ChecksumTypeProto convert(DataChecksum.Type type); static DatanodeLocalInfoProto convert(DatanodeLocalInfo info); static DatanodeLocalInfo convert(DatanodeLocalInfoProto proto); static InputStream vintPrefixed(final InputStream input); static List<AclEntryProto> convertAclEntryProto(
      List<AclEntry> aclSpec); static List<AclEntry> convertAclEntry(List<AclEntryProto> aclSpec); static AclStatus convert(GetAclStatusResponseProto e); static GetAclStatusResponseProto convert(AclStatus e); static ShortCircuitShmSlotProto convert(SlotId slotId); static ShortCircuitShmIdProto convert(ShmId shmId); static SlotId convert(ShortCircuitShmSlotProto slotId); static ShmId convert(ShortCircuitShmIdProto shmId); static HybridLogicalClock convert(HybridLogicalClockProto hlcp); static HybridLogicalClockProto convert(HybridLogicalClock hlc);  }
@Test public void testConvertLocatedBlock() { LocatedBlock lb = createLocatedBlock(); LocatedBlockProto lbProto = PBHelper.convert(lb); LocatedBlock lb2 = PBHelper.convert(lbProto); compare(lb,lb2); }
@Test public void testConvertLocatedBlockArray() { LocatedBlock [] lbl = new LocatedBlock[3]; for (int i=0;i<3;i++) { lbl[i] = createLocatedBlock(); } LocatedBlockProto [] lbpl = PBHelper.convertLocatedBlock(lbl); LocatedBlock [] lbl2 = PBHelper.convertLocatedBlock(lbpl); assertEquals(lbl.length, lbl2.length); for (int i=0;i<lbl.length;i++) { compare(lbl[i], lbl2[i]); } }