private static LocatedBlock convertLocatedBlock ( TLocatedBlock tblk ) { TBlock one = tblk . block ; Block hblock = new Block ( one . getBlockId ( ) , one . getNumBytes ( ) , one . getGenerationStamp ( ) ) ; List < TDatanodeID > locs = tblk . location ; DatanodeInfo [ ] dn = new DatanodeInfo [ locs . size ( ) ] ; for ( int j = 0 ; j < dn . length ; j ++ ) { String name = locs . get ( j ) . name ; dn [ j ] = new DatanodeInfo ( new DatanodeID ( name , "" , - 1 , getPort ( name ) ) ) ; } return new LocatedBlock ( hblock , dn ) ; }
Converts a TLocatedBlock to a LocatedBlock