Example usage for org.apache.hadoop.hdfs.protocol LocatedBlocks isLastBlockComplete

List of usage examples for org.apache.hadoop.hdfs.protocol LocatedBlocks isLastBlockComplete

Introduction

In this page you can find the example usage for org.apache.hadoop.hdfs.protocol LocatedBlocks isLastBlockComplete.

Prototype

boolean isLastBlockComplete

To view the source code for org.apache.hadoop.hdfs.protocol LocatedBlocks isLastBlockComplete.

Click Source Link

Usage

From source file:com.bigstep.datalake.JsonUtil.java

License:Apache License

/** Convert LocatedBlocks to a Json string. */
public static String toJsonString(final LocatedBlocks locatedblocks) throws IOException {
    if (locatedblocks == null) {
        return null;
    }//from   w w w  .ja  v a 2 s  . c  o m

    final Map<String, Object> m = new TreeMap<String, Object>();
    m.put("fileLength", locatedblocks.getFileLength());
    m.put("isUnderConstruction", locatedblocks.isUnderConstruction());

    m.put("locatedBlocks", toJsonArray(locatedblocks.getLocatedBlocks()));
    m.put("lastLocatedBlock", toJsonMap(locatedblocks.getLastLocatedBlock()));
    m.put("isLastBlockComplete", locatedblocks.isLastBlockComplete());
    return toJsonString(LocatedBlocks.class, m);
}