/**
   * Convert IGFS affinity block location into Hadoop affinity block location.
   *
   * @param block IGFS affinity block location.
   * @return Hadoop affinity block location.
   */
  private BlockLocation convert(IgfsBlockLocation block) {
    Collection<String> names = block.names();
    Collection<String> hosts = block.hosts();

    return new BlockLocation(
        names.toArray(new String[names.size()]) /* hostname:portNumber of data nodes */,
        hosts.toArray(new String[hosts.size()]) /* hostnames of data nodes */,
        block.start(),
        block.length()) {
      @Override
      public String toString() {
        try {
          return "BlockLocation [offset="
              + getOffset()
              + ", length="
              + getLength()
              + ", hosts="
              + Arrays.asList(getHosts())
              + ", names="
              + Arrays.asList(getNames())
              + ']';
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
    };
  }
  /**
   * @param location HDFS block location.
   * @param len New length.
   */
  public IgfsBlockLocationImpl(IgfsBlockLocation location, long len) {
    assert location != null;

    start = location.start();
    this.len = len;

    nodeIds = location.nodeIds();
    names = location.names();
    hosts = location.hosts();
  }