Java 类org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.HdfsFileStatusProto 实例源码

项目:hadoop    文件:PBHelper.java   
public static HdfsFileStatus convert(HdfsFileStatusProto fs) {
  if (fs == null)
    return null;
  return new HdfsLocatedFileStatus(
      fs.getLength(), fs.getFileType().equals(FileType.IS_DIR), 
      fs.getBlockReplication(), fs.getBlocksize(),
      fs.getModificationTime(), fs.getAccessTime(),
      PBHelper.convert(fs.getPermission()), fs.getOwner(), fs.getGroup(), 
      fs.getFileType().equals(FileType.IS_SYMLINK) ? 
          fs.getSymlink().toByteArray() : null,
      fs.getPath().toByteArray(),
      fs.hasFileId()? fs.getFileId(): INodeId.GRANDFATHER_INODE_ID,
      fs.hasLocations() ? PBHelper.convert(fs.getLocations()) : null,
      fs.hasChildrenNum() ? fs.getChildrenNum() : -1,
      fs.hasFileEncryptionInfo() ? convert(fs.getFileEncryptionInfo()) : null,
      fs.hasStoragePolicy() ? (byte) fs.getStoragePolicy()
          : BlockStoragePolicySuite.ID_UNSPECIFIED);
}
项目:hadoop    文件:PBHelper.java   
public static SnapshottableDirectoryStatus convert(
    SnapshottableDirectoryStatusProto sdirStatusProto) {
  if (sdirStatusProto == null) {
    return null;
  }
  final HdfsFileStatusProto status = sdirStatusProto.getDirStatus();
  return new SnapshottableDirectoryStatus(
      status.getModificationTime(),
      status.getAccessTime(),
      PBHelper.convert(status.getPermission()),
      status.getOwner(),
      status.getGroup(),
      status.getPath().toByteArray(),
      status.getFileId(),
      status.getChildrenNum(),
      sdirStatusProto.getSnapshotNumber(),
      sdirStatusProto.getSnapshotQuota(),
      sdirStatusProto.getParentFullpath().toByteArray());
}
项目:hadoop    文件:PBHelper.java   
public static SnapshottableDirectoryStatusProto convert(
    SnapshottableDirectoryStatus status) {
  if (status == null) {
    return null;
  }
  int snapshotNumber = status.getSnapshotNumber();
  int snapshotQuota = status.getSnapshotQuota();
  byte[] parentFullPath = status.getParentFullPath();
  ByteString parentFullPathBytes = ByteString.copyFrom(
      parentFullPath == null ? DFSUtil.EMPTY_BYTES : parentFullPath);
  HdfsFileStatusProto fs = convert(status.getDirStatus());
  SnapshottableDirectoryStatusProto.Builder builder = 
      SnapshottableDirectoryStatusProto
      .newBuilder().setSnapshotNumber(snapshotNumber)
      .setSnapshotQuota(snapshotQuota).setParentFullpath(parentFullPathBytes)
      .setDirStatus(fs);
  return builder.build();
}
项目:aliyun-oss-hadoop-fs    文件:PBHelperClient.java   
public static SnapshottableDirectoryStatus convert(
    SnapshottableDirectoryStatusProto sdirStatusProto) {
  if (sdirStatusProto == null) {
    return null;
  }
  final HdfsFileStatusProto status = sdirStatusProto.getDirStatus();
  return new SnapshottableDirectoryStatus(
      status.getModificationTime(),
      status.getAccessTime(),
      convert(status.getPermission()),
      status.getOwner(),
      status.getGroup(),
      status.getPath().toByteArray(),
      status.getFileId(),
      status.getChildrenNum(),
      sdirStatusProto.getSnapshotNumber(),
      sdirStatusProto.getSnapshotQuota(),
      sdirStatusProto.getParentFullpath().toByteArray());
}
项目:aliyun-oss-hadoop-fs    文件:PBHelperClient.java   
public static HdfsFileStatus convert(HdfsFileStatusProto fs) {
  if (fs == null)
    return null;
  return new HdfsLocatedFileStatus(
      fs.getLength(), fs.getFileType().equals(FileType.IS_DIR),
      fs.getBlockReplication(), fs.getBlocksize(),
      fs.getModificationTime(), fs.getAccessTime(),
      convert(fs.getPermission()), fs.getOwner(), fs.getGroup(),
      fs.getFileType().equals(FileType.IS_SYMLINK) ?
          fs.getSymlink().toByteArray() : null,
      fs.getPath().toByteArray(),
      fs.hasFileId()? fs.getFileId(): HdfsConstants.GRANDFATHER_INODE_ID,
      fs.hasLocations() ? convert(fs.getLocations()) : null,
      fs.hasChildrenNum() ? fs.getChildrenNum() : -1,
      fs.hasFileEncryptionInfo() ? convert(fs.getFileEncryptionInfo()) : null,
      fs.hasStoragePolicy() ? (byte) fs.getStoragePolicy()
          : HdfsConstants.BLOCK_STORAGE_POLICY_ID_UNSPECIFIED,
      fs.hasEcPolicy() ? convertErasureCodingPolicy(fs.getEcPolicy()) : null);
}
项目:aliyun-oss-hadoop-fs    文件:PBHelperClient.java   
public static SnapshottableDirectoryStatusProto convert(
    SnapshottableDirectoryStatus status) {
  if (status == null) {
    return null;
  }
  int snapshotNumber = status.getSnapshotNumber();
  int snapshotQuota = status.getSnapshotQuota();
  byte[] parentFullPath = status.getParentFullPath();
  ByteString parentFullPathBytes = getByteString(
      parentFullPath == null ? DFSUtilClient.EMPTY_BYTES : parentFullPath);
  HdfsFileStatusProto fs = convert(status.getDirStatus());
  SnapshottableDirectoryStatusProto.Builder builder =
      SnapshottableDirectoryStatusProto
          .newBuilder()
          .setSnapshotNumber(snapshotNumber)
          .setSnapshotQuota(snapshotQuota)
          .setParentFullpath(parentFullPathBytes)
          .setDirStatus(fs);
  return builder.build();
}
项目:big-c    文件:PBHelper.java   
public static HdfsFileStatus convert(HdfsFileStatusProto fs) {
  if (fs == null)
    return null;
  return new HdfsLocatedFileStatus(
      fs.getLength(), fs.getFileType().equals(FileType.IS_DIR), 
      fs.getBlockReplication(), fs.getBlocksize(),
      fs.getModificationTime(), fs.getAccessTime(),
      PBHelper.convert(fs.getPermission()), fs.getOwner(), fs.getGroup(), 
      fs.getFileType().equals(FileType.IS_SYMLINK) ? 
          fs.getSymlink().toByteArray() : null,
      fs.getPath().toByteArray(),
      fs.hasFileId()? fs.getFileId(): INodeId.GRANDFATHER_INODE_ID,
      fs.hasLocations() ? PBHelper.convert(fs.getLocations()) : null,
      fs.hasChildrenNum() ? fs.getChildrenNum() : -1,
      fs.hasFileEncryptionInfo() ? convert(fs.getFileEncryptionInfo()) : null,
      fs.hasStoragePolicy() ? (byte) fs.getStoragePolicy()
          : BlockStoragePolicySuite.ID_UNSPECIFIED);
}
项目:big-c    文件:PBHelper.java   
public static SnapshottableDirectoryStatus convert(
    SnapshottableDirectoryStatusProto sdirStatusProto) {
  if (sdirStatusProto == null) {
    return null;
  }
  final HdfsFileStatusProto status = sdirStatusProto.getDirStatus();
  return new SnapshottableDirectoryStatus(
      status.getModificationTime(),
      status.getAccessTime(),
      PBHelper.convert(status.getPermission()),
      status.getOwner(),
      status.getGroup(),
      status.getPath().toByteArray(),
      status.getFileId(),
      status.getChildrenNum(),
      sdirStatusProto.getSnapshotNumber(),
      sdirStatusProto.getSnapshotQuota(),
      sdirStatusProto.getParentFullpath().toByteArray());
}
项目:big-c    文件:PBHelper.java   
public static SnapshottableDirectoryStatusProto convert(
    SnapshottableDirectoryStatus status) {
  if (status == null) {
    return null;
  }
  int snapshotNumber = status.getSnapshotNumber();
  int snapshotQuota = status.getSnapshotQuota();
  byte[] parentFullPath = status.getParentFullPath();
  ByteString parentFullPathBytes = ByteString.copyFrom(
      parentFullPath == null ? DFSUtil.EMPTY_BYTES : parentFullPath);
  HdfsFileStatusProto fs = convert(status.getDirStatus());
  SnapshottableDirectoryStatusProto.Builder builder = 
      SnapshottableDirectoryStatusProto
      .newBuilder().setSnapshotNumber(snapshotNumber)
      .setSnapshotQuota(snapshotQuota).setParentFullpath(parentFullPathBytes)
      .setDirStatus(fs);
  return builder.build();
}
项目:hadoop-2.6.0-cdh5.4.3    文件:PBHelper.java   
public static HdfsFileStatus convert(HdfsFileStatusProto fs) {
  if (fs == null)
    return null;
  return new HdfsLocatedFileStatus(
      fs.getLength(), fs.getFileType().equals(FileType.IS_DIR), 
      fs.getBlockReplication(), fs.getBlocksize(),
      fs.getModificationTime(), fs.getAccessTime(),
      PBHelper.convert(fs.getPermission()), fs.getOwner(), fs.getGroup(), 
      fs.getFileType().equals(FileType.IS_SYMLINK) ? 
          fs.getSymlink().toByteArray() : null,
      fs.getPath().toByteArray(),
      fs.hasFileId()? fs.getFileId(): INodeId.GRANDFATHER_INODE_ID,
      fs.hasLocations() ? PBHelper.convert(fs.getLocations()) : null,
      fs.hasChildrenNum() ? fs.getChildrenNum() : -1,
      fs.hasFileEncryptionInfo() ? convert(fs.getFileEncryptionInfo()) : null,
      fs.hasStoragePolicy() ? (byte) fs.getStoragePolicy()
          : BlockStoragePolicySuite.ID_UNSPECIFIED);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:PBHelper.java   
public static SnapshottableDirectoryStatus convert(
    SnapshottableDirectoryStatusProto sdirStatusProto) {
  if (sdirStatusProto == null) {
    return null;
  }
  final HdfsFileStatusProto status = sdirStatusProto.getDirStatus();
  return new SnapshottableDirectoryStatus(
      status.getModificationTime(),
      status.getAccessTime(),
      PBHelper.convert(status.getPermission()),
      status.getOwner(),
      status.getGroup(),
      status.getPath().toByteArray(),
      status.getFileId(),
      status.getChildrenNum(),
      sdirStatusProto.getSnapshotNumber(),
      sdirStatusProto.getSnapshotQuota(),
      sdirStatusProto.getParentFullpath().toByteArray());
}
项目:hadoop-2.6.0-cdh5.4.3    文件:PBHelper.java   
public static SnapshottableDirectoryStatusProto convert(
    SnapshottableDirectoryStatus status) {
  if (status == null) {
    return null;
  }
  int snapshotNumber = status.getSnapshotNumber();
  int snapshotQuota = status.getSnapshotQuota();
  byte[] parentFullPath = status.getParentFullPath();
  ByteString parentFullPathBytes = ByteString.copyFrom(
      parentFullPath == null ? DFSUtil.EMPTY_BYTES : parentFullPath);
  HdfsFileStatusProto fs = convert(status.getDirStatus());
  SnapshottableDirectoryStatusProto.Builder builder = 
      SnapshottableDirectoryStatusProto
      .newBuilder().setSnapshotNumber(snapshotNumber)
      .setSnapshotQuota(snapshotQuota).setParentFullpath(parentFullPathBytes)
      .setDirStatus(fs);
  return builder.build();
}
项目:hadoop-plus    文件:PBHelper.java   
public static SnapshottableDirectoryStatus convert(
    SnapshottableDirectoryStatusProto sdirStatusProto) {
  if (sdirStatusProto == null) {
    return null;
  }
  final HdfsFileStatusProto status = sdirStatusProto.getDirStatus();
  return new SnapshottableDirectoryStatus(
      status.getModificationTime(),
      status.getAccessTime(),
      PBHelper.convert(status.getPermission()),
      status.getOwner(),
      status.getGroup(),
      status.getPath().toByteArray(),
      status.getFileId(),
      status.getChildrenNum(),
      sdirStatusProto.getSnapshotNumber(),
      sdirStatusProto.getSnapshotQuota(),
      sdirStatusProto.getParentFullpath().toByteArray());
}
项目:hadoop-plus    文件:PBHelper.java   
public static SnapshottableDirectoryStatusProto convert(
    SnapshottableDirectoryStatus status) {
  if (status == null) {
    return null;
  }
  int snapshotNumber = status.getSnapshotNumber();
  int snapshotQuota = status.getSnapshotQuota();
  byte[] parentFullPath = status.getParentFullPath();
  ByteString parentFullPathBytes = ByteString.copyFrom(
      parentFullPath == null ? DFSUtil.EMPTY_BYTES : parentFullPath);
  HdfsFileStatusProto fs = convert(status.getDirStatus());
  SnapshottableDirectoryStatusProto.Builder builder = 
      SnapshottableDirectoryStatusProto
      .newBuilder().setSnapshotNumber(snapshotNumber)
      .setSnapshotQuota(snapshotQuota).setParentFullpath(parentFullPathBytes)
      .setDirStatus(fs);
  return builder.build();
}
项目:FlexMap    文件:PBHelper.java   
public static HdfsFileStatus convert(HdfsFileStatusProto fs) {
  if (fs == null)
    return null;
  return new HdfsLocatedFileStatus(
      fs.getLength(), fs.getFileType().equals(FileType.IS_DIR), 
      fs.getBlockReplication(), fs.getBlocksize(),
      fs.getModificationTime(), fs.getAccessTime(),
      PBHelper.convert(fs.getPermission()), fs.getOwner(), fs.getGroup(), 
      fs.getFileType().equals(FileType.IS_SYMLINK) ? 
          fs.getSymlink().toByteArray() : null,
      fs.getPath().toByteArray(),
      fs.hasFileId()? fs.getFileId(): INodeId.GRANDFATHER_INODE_ID,
      fs.hasLocations() ? PBHelper.convert(fs.getLocations()) : null,
      fs.hasChildrenNum() ? fs.getChildrenNum() : -1,
      fs.hasFileEncryptionInfo() ? convert(fs.getFileEncryptionInfo()) : null,
      fs.hasStoragePolicy() ? (byte) fs.getStoragePolicy()
          : BlockStoragePolicySuite.ID_UNSPECIFIED);
}
项目:FlexMap    文件:PBHelper.java   
public static SnapshottableDirectoryStatus convert(
    SnapshottableDirectoryStatusProto sdirStatusProto) {
  if (sdirStatusProto == null) {
    return null;
  }
  final HdfsFileStatusProto status = sdirStatusProto.getDirStatus();
  return new SnapshottableDirectoryStatus(
      status.getModificationTime(),
      status.getAccessTime(),
      PBHelper.convert(status.getPermission()),
      status.getOwner(),
      status.getGroup(),
      status.getPath().toByteArray(),
      status.getFileId(),
      status.getChildrenNum(),
      sdirStatusProto.getSnapshotNumber(),
      sdirStatusProto.getSnapshotQuota(),
      sdirStatusProto.getParentFullpath().toByteArray());
}
项目:FlexMap    文件:PBHelper.java   
public static SnapshottableDirectoryStatusProto convert(
    SnapshottableDirectoryStatus status) {
  if (status == null) {
    return null;
  }
  int snapshotNumber = status.getSnapshotNumber();
  int snapshotQuota = status.getSnapshotQuota();
  byte[] parentFullPath = status.getParentFullPath();
  ByteString parentFullPathBytes = ByteString.copyFrom(
      parentFullPath == null ? DFSUtil.EMPTY_BYTES : parentFullPath);
  HdfsFileStatusProto fs = convert(status.getDirStatus());
  SnapshottableDirectoryStatusProto.Builder builder = 
      SnapshottableDirectoryStatusProto
      .newBuilder().setSnapshotNumber(snapshotNumber)
      .setSnapshotQuota(snapshotQuota).setParentFullpath(parentFullPathBytes)
      .setDirStatus(fs);
  return builder.build();
}
项目:hadoop-TCP    文件:PBHelper.java   
public static SnapshottableDirectoryStatus convert(
    SnapshottableDirectoryStatusProto sdirStatusProto) {
  if (sdirStatusProto == null) {
    return null;
  }
  final HdfsFileStatusProto status = sdirStatusProto.getDirStatus();
  return new SnapshottableDirectoryStatus(
      status.getModificationTime(),
      status.getAccessTime(),
      PBHelper.convert(status.getPermission()),
      status.getOwner(),
      status.getGroup(),
      status.getPath().toByteArray(),
      status.getFileId(),
      status.getChildrenNum(),
      sdirStatusProto.getSnapshotNumber(),
      sdirStatusProto.getSnapshotQuota(),
      sdirStatusProto.getParentFullpath().toByteArray());
}
项目:hadoop-TCP    文件:PBHelper.java   
public static SnapshottableDirectoryStatusProto convert(
    SnapshottableDirectoryStatus status) {
  if (status == null) {
    return null;
  }
  int snapshotNumber = status.getSnapshotNumber();
  int snapshotQuota = status.getSnapshotQuota();
  byte[] parentFullPath = status.getParentFullPath();
  ByteString parentFullPathBytes = ByteString.copyFrom(
      parentFullPath == null ? DFSUtil.EMPTY_BYTES : parentFullPath);
  HdfsFileStatusProto fs = convert(status.getDirStatus());
  SnapshottableDirectoryStatusProto.Builder builder = 
      SnapshottableDirectoryStatusProto
      .newBuilder().setSnapshotNumber(snapshotNumber)
      .setSnapshotQuota(snapshotQuota).setParentFullpath(parentFullPathBytes)
      .setDirStatus(fs);
  return builder.build();
}
项目:hardfs    文件:PBHelper.java   
public static SnapshottableDirectoryStatus convert(
    SnapshottableDirectoryStatusProto sdirStatusProto) {
  if (sdirStatusProto == null) {
    return null;
  }
  final HdfsFileStatusProto status = sdirStatusProto.getDirStatus();
  return new SnapshottableDirectoryStatus(
      status.getModificationTime(),
      status.getAccessTime(),
      PBHelper.convert(status.getPermission()),
      status.getOwner(),
      status.getGroup(),
      status.getPath().toByteArray(),
      status.getFileId(),
      status.getChildrenNum(),
      sdirStatusProto.getSnapshotNumber(),
      sdirStatusProto.getSnapshotQuota(),
      sdirStatusProto.getParentFullpath().toByteArray());
}
项目:hardfs    文件:PBHelper.java   
public static SnapshottableDirectoryStatusProto convert(
    SnapshottableDirectoryStatus status) {
  if (status == null) {
    return null;
  }
  int snapshotNumber = status.getSnapshotNumber();
  int snapshotQuota = status.getSnapshotQuota();
  byte[] parentFullPath = status.getParentFullPath();
  ByteString parentFullPathBytes = ByteString.copyFrom(
      parentFullPath == null ? DFSUtil.EMPTY_BYTES : parentFullPath);
  HdfsFileStatusProto fs = convert(status.getDirStatus());
  SnapshottableDirectoryStatusProto.Builder builder = 
      SnapshottableDirectoryStatusProto
      .newBuilder().setSnapshotNumber(snapshotNumber)
      .setSnapshotQuota(snapshotQuota).setParentFullpath(parentFullPathBytes)
      .setDirStatus(fs);
  return builder.build();
}
项目:hadoop-on-lustre2    文件:PBHelper.java   
public static SnapshottableDirectoryStatus convert(
    SnapshottableDirectoryStatusProto sdirStatusProto) {
  if (sdirStatusProto == null) {
    return null;
  }
  final HdfsFileStatusProto status = sdirStatusProto.getDirStatus();
  return new SnapshottableDirectoryStatus(
      status.getModificationTime(),
      status.getAccessTime(),
      PBHelper.convert(status.getPermission()),
      status.getOwner(),
      status.getGroup(),
      status.getPath().toByteArray(),
      status.getFileId(),
      status.getChildrenNum(),
      sdirStatusProto.getSnapshotNumber(),
      sdirStatusProto.getSnapshotQuota(),
      sdirStatusProto.getParentFullpath().toByteArray());
}
项目:hadoop-on-lustre2    文件:PBHelper.java   
public static SnapshottableDirectoryStatusProto convert(
    SnapshottableDirectoryStatus status) {
  if (status == null) {
    return null;
  }
  int snapshotNumber = status.getSnapshotNumber();
  int snapshotQuota = status.getSnapshotQuota();
  byte[] parentFullPath = status.getParentFullPath();
  ByteString parentFullPathBytes = ByteString.copyFrom(
      parentFullPath == null ? DFSUtil.EMPTY_BYTES : parentFullPath);
  HdfsFileStatusProto fs = convert(status.getDirStatus());
  SnapshottableDirectoryStatusProto.Builder builder = 
      SnapshottableDirectoryStatusProto
      .newBuilder().setSnapshotNumber(snapshotNumber)
      .setSnapshotQuota(snapshotQuota).setParentFullpath(parentFullPathBytes)
      .setDirStatus(fs);
  return builder.build();
}
项目:hadoop    文件:PBHelper.java   
public static HdfsFileStatusProto convert(HdfsFileStatus fs) {
  if (fs == null)
    return null;
  FileType fType = FileType.IS_FILE;
  if (fs.isDir()) {
    fType = FileType.IS_DIR;
  } else if (fs.isSymlink()) {
    fType = FileType.IS_SYMLINK;
  }

  HdfsFileStatusProto.Builder builder = 
   HdfsFileStatusProto.newBuilder().
    setLength(fs.getLen()).
    setFileType(fType).
    setBlockReplication(fs.getReplication()).
    setBlocksize(fs.getBlockSize()).
    setModificationTime(fs.getModificationTime()).
    setAccessTime(fs.getAccessTime()).
    setPermission(PBHelper.convert(fs.getPermission())).
    setOwner(fs.getOwner()).
    setGroup(fs.getGroup()).
    setFileId(fs.getFileId()).
    setChildrenNum(fs.getChildrenNum()).
    setPath(ByteString.copyFrom(fs.getLocalNameInBytes())).
    setStoragePolicy(fs.getStoragePolicy());
  if (fs.isSymlink())  {
    builder.setSymlink(ByteString.copyFrom(fs.getSymlinkInBytes()));
  }
  if (fs.getFileEncryptionInfo() != null) {
    builder.setFileEncryptionInfo(convert(fs.getFileEncryptionInfo()));
  }
  if (fs instanceof HdfsLocatedFileStatus) {
    final HdfsLocatedFileStatus lfs = (HdfsLocatedFileStatus) fs;
    LocatedBlocks locations = lfs.getBlockLocations();
    if (locations != null) {
      builder.setLocations(PBHelper.convert(locations));
    }
  }
  return builder.build();
}
项目:hadoop    文件:PBHelper.java   
public static HdfsFileStatusProto[] convert(HdfsFileStatus[] fs) {
  if (fs == null) return null;
  final int len = fs.length;
  HdfsFileStatusProto[] result = new HdfsFileStatusProto[len];
  for (int i = 0; i < len; ++i) {
    result[i] = PBHelper.convert(fs[i]);
  }
  return result;
}
项目:hadoop    文件:PBHelper.java   
public static HdfsFileStatus[] convert(HdfsFileStatusProto[] fs) {
  if (fs == null) return null;
  final int len = fs.length;
  HdfsFileStatus[] result = new HdfsFileStatus[len];
  for (int i = 0; i < len; ++i) {
    result[i] = PBHelper.convert(fs[i]);
  }
  return result;
}
项目:hadoop    文件:PBHelper.java   
public static DirectoryListing convert(DirectoryListingProto dl) {
  if (dl == null)
    return null;
  List<HdfsFileStatusProto> partList =  dl.getPartialListingList();
  return new DirectoryListing( 
      partList.isEmpty() ? new HdfsLocatedFileStatus[0] 
        : PBHelper.convert(
            partList.toArray(new HdfsFileStatusProto[partList.size()])),
      dl.getRemainingEntries());
}
项目:aliyun-oss-hadoop-fs    文件:PBHelperClient.java   
public static DirectoryListing convert(DirectoryListingProto dl) {
  if (dl == null)
    return null;
  List<HdfsFileStatusProto> partList =  dl.getPartialListingList();
  return new DirectoryListing(partList.isEmpty() ?
      new HdfsLocatedFileStatus[0] :
      convert(partList.toArray(new HdfsFileStatusProto[partList.size()])),
      dl.getRemainingEntries());
}
项目:aliyun-oss-hadoop-fs    文件:PBHelperClient.java   
public static HdfsFileStatus[] convert(HdfsFileStatusProto[] fs) {
  if (fs == null) return null;
  final int len = fs.length;
  HdfsFileStatus[] result = new HdfsFileStatus[len];
  for (int i = 0; i < len; ++i) {
    result[i] = convert(fs[i]);
  }
  return result;
}
项目:aliyun-oss-hadoop-fs    文件:PBHelperClient.java   
public static HdfsFileStatusProto[] convert(HdfsFileStatus[] fs) {
  if (fs == null) return null;
  final int len = fs.length;
  HdfsFileStatusProto[] result = new HdfsFileStatusProto[len];
  for (int i = 0; i < len; ++i) {
    result[i] = convert(fs[i]);
  }
  return result;
}
项目:big-c    文件:PBHelper.java   
public static HdfsFileStatusProto convert(HdfsFileStatus fs) {
  if (fs == null)
    return null;
  FileType fType = FileType.IS_FILE;
  if (fs.isDir()) {
    fType = FileType.IS_DIR;
  } else if (fs.isSymlink()) {
    fType = FileType.IS_SYMLINK;
  }

  HdfsFileStatusProto.Builder builder = 
   HdfsFileStatusProto.newBuilder().
    setLength(fs.getLen()).
    setFileType(fType).
    setBlockReplication(fs.getReplication()).
    setBlocksize(fs.getBlockSize()).
    setModificationTime(fs.getModificationTime()).
    setAccessTime(fs.getAccessTime()).
    setPermission(PBHelper.convert(fs.getPermission())).
    setOwner(fs.getOwner()).
    setGroup(fs.getGroup()).
    setFileId(fs.getFileId()).
    setChildrenNum(fs.getChildrenNum()).
    setPath(ByteString.copyFrom(fs.getLocalNameInBytes())).
    setStoragePolicy(fs.getStoragePolicy());
  if (fs.isSymlink())  {
    builder.setSymlink(ByteString.copyFrom(fs.getSymlinkInBytes()));
  }
  if (fs.getFileEncryptionInfo() != null) {
    builder.setFileEncryptionInfo(convert(fs.getFileEncryptionInfo()));
  }
  if (fs instanceof HdfsLocatedFileStatus) {
    final HdfsLocatedFileStatus lfs = (HdfsLocatedFileStatus) fs;
    LocatedBlocks locations = lfs.getBlockLocations();
    if (locations != null) {
      builder.setLocations(PBHelper.convert(locations));
    }
  }
  return builder.build();
}
项目:big-c    文件:PBHelper.java   
public static HdfsFileStatusProto[] convert(HdfsFileStatus[] fs) {
  if (fs == null) return null;
  final int len = fs.length;
  HdfsFileStatusProto[] result = new HdfsFileStatusProto[len];
  for (int i = 0; i < len; ++i) {
    result[i] = PBHelper.convert(fs[i]);
  }
  return result;
}
项目:big-c    文件:PBHelper.java   
public static HdfsFileStatus[] convert(HdfsFileStatusProto[] fs) {
  if (fs == null) return null;
  final int len = fs.length;
  HdfsFileStatus[] result = new HdfsFileStatus[len];
  for (int i = 0; i < len; ++i) {
    result[i] = PBHelper.convert(fs[i]);
  }
  return result;
}
项目:big-c    文件:PBHelper.java   
public static DirectoryListing convert(DirectoryListingProto dl) {
  if (dl == null)
    return null;
  List<HdfsFileStatusProto> partList =  dl.getPartialListingList();
  return new DirectoryListing( 
      partList.isEmpty() ? new HdfsLocatedFileStatus[0] 
        : PBHelper.convert(
            partList.toArray(new HdfsFileStatusProto[partList.size()])),
      dl.getRemainingEntries());
}
项目:hadoop-2.6.0-cdh5.4.3    文件:PBHelper.java   
public static HdfsFileStatusProto convert(HdfsFileStatus fs) {
  if (fs == null)
    return null;
  FileType fType = FileType.IS_FILE;
  if (fs.isDir()) {
    fType = FileType.IS_DIR;
  } else if (fs.isSymlink()) {
    fType = FileType.IS_SYMLINK;
  }

  HdfsFileStatusProto.Builder builder = 
   HdfsFileStatusProto.newBuilder().
    setLength(fs.getLen()).
    setFileType(fType).
    setBlockReplication(fs.getReplication()).
    setBlocksize(fs.getBlockSize()).
    setModificationTime(fs.getModificationTime()).
    setAccessTime(fs.getAccessTime()).
    setPermission(PBHelper.convert(fs.getPermission())).
    setOwner(fs.getOwner()).
    setGroup(fs.getGroup()).
    setFileId(fs.getFileId()).
    setChildrenNum(fs.getChildrenNum()).
    setPath(ByteString.copyFrom(fs.getLocalNameInBytes())).
    setStoragePolicy(fs.getStoragePolicy());
  if (fs.isSymlink())  {
    builder.setSymlink(ByteString.copyFrom(fs.getSymlinkInBytes()));
  }
  if (fs.getFileEncryptionInfo() != null) {
    builder.setFileEncryptionInfo(convert(fs.getFileEncryptionInfo()));
  }
  if (fs instanceof HdfsLocatedFileStatus) {
    final HdfsLocatedFileStatus lfs = (HdfsLocatedFileStatus) fs;
    LocatedBlocks locations = lfs.getBlockLocations();
    if (locations != null) {
      builder.setLocations(PBHelper.convert(locations));
    }
  }
  return builder.build();
}
项目:hadoop-2.6.0-cdh5.4.3    文件:PBHelper.java   
public static HdfsFileStatusProto[] convert(HdfsFileStatus[] fs) {
  if (fs == null) return null;
  final int len = fs.length;
  HdfsFileStatusProto[] result = new HdfsFileStatusProto[len];
  for (int i = 0; i < len; ++i) {
    result[i] = PBHelper.convert(fs[i]);
  }
  return result;
}
项目:hadoop-2.6.0-cdh5.4.3    文件:PBHelper.java   
public static HdfsFileStatus[] convert(HdfsFileStatusProto[] fs) {
  if (fs == null) return null;
  final int len = fs.length;
  HdfsFileStatus[] result = new HdfsFileStatus[len];
  for (int i = 0; i < len; ++i) {
    result[i] = PBHelper.convert(fs[i]);
  }
  return result;
}
项目:hadoop-2.6.0-cdh5.4.3    文件:PBHelper.java   
public static DirectoryListing convert(DirectoryListingProto dl) {
  if (dl == null)
    return null;
  List<HdfsFileStatusProto> partList =  dl.getPartialListingList();
  return new DirectoryListing( 
      partList.isEmpty() ? new HdfsLocatedFileStatus[0] 
        : PBHelper.convert(
            partList.toArray(new HdfsFileStatusProto[partList.size()])),
      dl.getRemainingEntries());
}
项目:hadoop-plus    文件:PBHelper.java   
public static HdfsFileStatus convert(HdfsFileStatusProto fs) {
  if (fs == null)
    return null;
  return new HdfsLocatedFileStatus(
      fs.getLength(), fs.getFileType().equals(FileType.IS_DIR), 
      fs.getBlockReplication(), fs.getBlocksize(),
      fs.getModificationTime(), fs.getAccessTime(),
      PBHelper.convert(fs.getPermission()), fs.getOwner(), fs.getGroup(), 
      fs.getFileType().equals(FileType.IS_SYMLINK) ? 
          fs.getSymlink().toByteArray() : null,
      fs.getPath().toByteArray(),
      fs.hasFileId()? fs.getFileId(): INodeId.GRANDFATHER_INODE_ID,
      fs.hasLocations() ? PBHelper.convert(fs.getLocations()) : null,
      fs.hasChildrenNum() ? fs.getChildrenNum() : 0);
}
项目:hadoop-plus    文件:PBHelper.java   
public static HdfsFileStatusProto convert(HdfsFileStatus fs) {
  if (fs == null)
    return null;
  FileType fType = FileType.IS_FILE;
  if (fs.isDir()) {
    fType = FileType.IS_DIR;
  } else if (fs.isSymlink()) {
    fType = FileType.IS_SYMLINK;
  }

  HdfsFileStatusProto.Builder builder = 
   HdfsFileStatusProto.newBuilder().
    setLength(fs.getLen()).
    setFileType(fType).
    setBlockReplication(fs.getReplication()).
    setBlocksize(fs.getBlockSize()).
    setModificationTime(fs.getModificationTime()).
    setAccessTime(fs.getAccessTime()).
    setPermission(PBHelper.convert(fs.getPermission())).
    setOwner(fs.getOwner()).
    setGroup(fs.getGroup()).
    setFileId(fs.getFileId()).
    setChildrenNum(fs.getChildrenNum()).
    setPath(ByteString.copyFrom(fs.getLocalNameInBytes()));
  if (fs.isSymlink())  {
    builder.setSymlink(ByteString.copyFrom(fs.getSymlinkInBytes()));
  }
  if (fs instanceof HdfsLocatedFileStatus) {
    LocatedBlocks locations = ((HdfsLocatedFileStatus)fs).getBlockLocations();
    if (locations != null) {
      builder.setLocations(PBHelper.convert(locations));
    }
  }
  return builder.build();
}