public static Map<String, byte[]> toXAttrs(final Map<?, ?> json) throws IOException { if (json == null) { return null; } return toXAttrMap(getList(json, "XAttrs")); }
public static Map<String, byte[]> toXAttrs(final Map<?, ?> json) throws IOException { if (json == null) { return null; } return toXAttrMap(getList(json, "XAttrs")); }
@Override FileStatus[] decodeResponse(Map<?,?> json) { final Map<?, ?> rootmap = (Map<?, ?>)json.get(FileStatus.class.getSimpleName() + "es"); final List<?> array = JsonUtil.getList( rootmap, FileStatus.class.getSimpleName()); //convert FileStatus final FileStatus[] statuses = new FileStatus[array.size()]; int i = 0; for (Object object : array) { final Map<?, ?> m = (Map<?, ?>) object; statuses[i++] = makeQualified(JsonUtil.toFileStatus(m, false), f); } return statuses; } }.run();
@Override FileStatus[] decodeResponse(Map<?,?> json) { final Map<?, ?> rootmap = (Map<?, ?>)json.get(FileStatus.class.getSimpleName() + "es"); final List<?> array = JsonUtil.getList( rootmap, FileStatus.class.getSimpleName()); //convert FileStatus final FileStatus[] statuses = new FileStatus[array.size()]; int i = 0; for (Object object : array) { final Map<?, ?> m = (Map<?, ?>) object; statuses[i++] = makeQualified(JsonUtil.toFileStatus(m, false), f); } return statuses; } }.run();
/** Convert a Json map to LocatedBlock. */ public static LocatedBlocks toLocatedBlocks(final Map<?, ?> json ) throws IOException { if (json == null) { return null; } final Map<?, ?> m = (Map<?, ?>)json.get(LocatedBlocks.class.getSimpleName()); final long fileLength = ((Number) m.get("fileLength")).longValue(); final boolean isUnderConstruction = (Boolean)m.get("isUnderConstruction"); final List<LocatedBlock> locatedBlocks = toLocatedBlockList( getList(m, "locatedBlocks")); final LocatedBlock lastLocatedBlock = toLocatedBlock( (Map<?, ?>)m.get("lastLocatedBlock")); final boolean isLastBlockComplete = (Boolean)m.get("isLastBlockComplete"); return new LocatedBlocks(fileLength, isUnderConstruction, locatedBlocks, lastLocatedBlock, isLastBlockComplete, null); }
/** Convert a Json map to LocatedBlock. */ public static LocatedBlocks toLocatedBlocks(final Map<?, ?> json ) throws IOException { if (json == null) { return null; } final Map<?, ?> m = (Map<?, ?>)json.get(LocatedBlocks.class.getSimpleName()); final long fileLength = ((Number) m.get("fileLength")).longValue(); final boolean isUnderConstruction = (Boolean)m.get("isUnderConstruction"); final List<LocatedBlock> locatedBlocks = toLocatedBlockList( getList(m, "locatedBlocks")); final LocatedBlock lastLocatedBlock = toLocatedBlock( (Map<?, ?>)m.get("lastLocatedBlock")); final boolean isLastBlockComplete = (Boolean)m.get("isLastBlockComplete"); return new LocatedBlocks(fileLength, isUnderConstruction, locatedBlocks, lastLocatedBlock, isLastBlockComplete, null); }
/** Convert a Json map to LocatedBlock. */ private static LocatedBlock toLocatedBlock(final Map<?, ?> m) throws IOException { if (m == null) { return null; } 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; }
/** Convert a Json map to LocatedBlock. */ private static LocatedBlock toLocatedBlock(final Map<?, ?> m) throws IOException { if (m == null) { return null; } 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; }