List of usage examples for org.apache.hadoop.hdfs.protocol LocatedBlock LocatedBlock
public LocatedBlock(ExtendedBlock b, DatanodeInfoWithStorage[] locs, String[] storageIDs, StorageType[] storageTypes, long startOffset, boolean corrupt, DatanodeInfo[] cachedLocs)
From source file:com.bigstep.datalake.JsonUtil.java
License:Apache License
/** Convert a Json map to LocatedBlock. */ private static LocatedBlock toLocatedBlock(final Map<?, ?> m) throws IOException { if (m == null) { return null; }//from w ww. j a v a 2s . c o m final ExtendedBlock b = toExtendedBlock((Map<?, ?>) m.get("block")); final DatanodeInfo[] locations = toDatanodeInfoArray(getList(m, "locations")); final long startOffset = ((Number) m.get("startOffset")).longValue(); final boolean isCorrupt = (Boolean) m.get("isCorrupt"); final DatanodeInfo[] cachedLocations = toDatanodeInfoArray(getList(m, "cachedLocations")); final LocatedBlock locatedblock = new LocatedBlock(b, locations, null, null, startOffset, isCorrupt, cachedLocations); locatedblock.setBlockToken(toBlockToken((Map<?, ?>) m.get("blockToken"))); return locatedblock; }