当前位置: 首页>>代码示例>>Java>>正文


Java DFSUtil.bytes2String方法代码示例

本文整理汇总了Java中org.apache.hadoop.hdfs.DFSUtil.bytes2String方法的典型用法代码示例。如果您正苦于以下问题:Java DFSUtil.bytes2String方法的具体用法?Java DFSUtil.bytes2String怎么用?Java DFSUtil.bytes2String使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hdfs.DFSUtil的用法示例。


在下文中一共展示了DFSUtil.bytes2String方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPathString

import org.apache.hadoop.hdfs.DFSUtil; //导入方法依赖的package包/类
static String getPathString(byte[] path) {
  String pathStr = DFSUtil.bytes2String(path);
  if (pathStr.isEmpty()) {
    return Path.CUR_DIR;
  } else {
    return Path.CUR_DIR + Path.SEPARATOR + pathStr;
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:SnapshotDiffReport.java

示例2: verifyMaxComponentLength

import org.apache.hadoop.hdfs.DFSUtil; //导入方法依赖的package包/类
/**
 * Verify child's name for fs limit.
 *
 * @param childName byte[] containing new child name
 * @param parentPath String containing parent path
 * @throws PathComponentTooLongException child's name is too long.
 */
void verifyMaxComponentLength(byte[] childName, String parentPath)
    throws PathComponentTooLongException {
  if (maxComponentLength == 0) {
    return;
  }

  final int length = childName.length;
  if (length > maxComponentLength) {
    final PathComponentTooLongException e = new PathComponentTooLongException(
        maxComponentLength, length, parentPath,
        DFSUtil.bytes2String(childName));
    if (namesystem.isImageLoaded()) {
      throw e;
    } else {
      // Do not throw if edits log is still being processed
      NameNode.LOG.error("ERROR in FSDirectory.verifyINodeName", e);
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:27,代码来源:FSDirectory.java

示例3: resolveDotInodesPath

import org.apache.hadoop.hdfs.DFSUtil; //导入方法依赖的package包/类
private static String resolveDotInodesPath(String src,
    byte[][] pathComponents, FSDirectory fsd)
    throws FileNotFoundException {
  final String inodeId = DFSUtil.bytes2String(pathComponents[3]);
  final long id;
  try {
    id = Long.parseLong(inodeId);
  } catch (NumberFormatException e) {
    throw new FileNotFoundException("Invalid inode path: " + src);
  }
  if (id == INodeId.ROOT_INODE_ID && pathComponents.length == 4) {
    return Path.SEPARATOR;
  }
  INode inode = fsd.getInode(id);
  if (inode == null) {
    throw new FileNotFoundException(
        "File for given inode path does not exist: " + src);
  }
  
  // Handle single ".." for NFS lookup support.
  if ((pathComponents.length > 4)
      && DFSUtil.bytes2String(pathComponents[4]).equals("..")) {
    INode parent = inode.getParent();
    if (parent == null || parent.getId() == INodeId.ROOT_INODE_ID) {
      // inode is root, or its parent is root.
      return Path.SEPARATOR;
    } else {
      return parent.getFullPathName();
    }
  }

  String path = "";
  if (id != INodeId.ROOT_INODE_ID) {
    path = inode.getFullPathName();
  }
  return constructRemainingPath(path, pathComponents, 4);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:38,代码来源:FSDirectory.java

示例4: loadCreated

import org.apache.hadoop.hdfs.DFSUtil; //导入方法依赖的package包/类
/**
 * Load a node stored in the created list from fsimage.
 * @param createdNodeName The name of the created node.
 * @param parent The directory that the created list belongs to.
 * @return The created node.
 */
public static INode loadCreated(byte[] createdNodeName,
    INodeDirectory parent) throws IOException {
  // the INode in the created list should be a reference to another INode
  // in posterior SnapshotDiffs or one of the current children
  for (DirectoryDiff postDiff : parent.getDiffs()) {
    final INode d = postDiff.getChildrenDiff().search(ListType.DELETED,
        createdNodeName);
    if (d != null) {
      return d;
    } // else go to the next SnapshotDiff
  } 
  // use the current child
  INode currentChild = parent.getChild(createdNodeName,
      Snapshot.CURRENT_STATE_ID);
  if (currentChild == null) {
    throw new IOException("Cannot find an INode associated with the INode "
        + DFSUtil.bytes2String(createdNodeName)
        + " in created list while loading FSImage.");
  }
  return currentChild;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:28,代码来源:SnapshotFSImageFormat.java

示例5: getFullPath

import org.apache.hadoop.hdfs.DFSUtil; //导入方法依赖的package包/类
/**
 * @return Full path of the file
 */
public Path getFullPath() {
  String parentFullPathStr = 
      (parentFullPath == null || parentFullPath.length == 0) ? 
          null : DFSUtil.bytes2String(parentFullPath);
  if (parentFullPathStr == null
      && dirStatus.getLocalNameInBytes().length == 0) {
    // root
    return new Path("/");
  } else {
    return parentFullPathStr == null ? new Path(dirStatus.getLocalName())
        : new Path(parentFullPathStr, dirStatus.getLocalName());
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:SnapshottableDirectoryStatus.java

示例6: getINodeAttrs

import org.apache.hadoop.hdfs.DFSUtil; //导入方法依赖的package包/类
private INodeAttributes getINodeAttrs(byte[][] pathByNameArr, int pathIdx,
    INode inode, int snapshotId) {
  INodeAttributes inodeAttrs = inode.getSnapshotINode(snapshotId);
  if (getAttributesProvider() != null) {
    String[] elements = new String[pathIdx + 1];
    for (int i = 0; i < elements.length; i++) {
      elements[i] = DFSUtil.bytes2String(pathByNameArr[i]);
    }
    inodeAttrs = getAttributesProvider().getAttributes(elements, inodeAttrs);
  }
  return inodeAttrs;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:FSPermissionChecker.java

示例7: getAttributes

import org.apache.hadoop.hdfs.DFSUtil; //导入方法依赖的package包/类
INodeAttributes getAttributes(String fullPath, byte[] path,
    INode node, int snapshot) {
  INodeAttributes nodeAttrs = node;
  if (attributeProvider != null) {
    nodeAttrs = node.getSnapshotINode(snapshot);
    fullPath = fullPath + (fullPath.endsWith(Path.SEPARATOR) ? ""
                                                             : Path.SEPARATOR)
        + DFSUtil.bytes2String(path);
    nodeAttrs = attributeProvider.getAttributes(fullPath, nodeAttrs);
  } else {
    nodeAttrs = node.getSnapshotINode(snapshot);
  }
  return nodeAttrs;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:FSDirectory.java

示例8: getSymlinkString

import org.apache.hadoop.hdfs.DFSUtil; //导入方法依赖的package包/类
public String getSymlinkString() {
  return DFSUtil.bytes2String(symlink);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:4,代码来源:INodeSymlink.java

示例9: getLocalName

import org.apache.hadoop.hdfs.DFSUtil; //导入方法依赖的package包/类
/**
 * @return null if the local name is null; otherwise, return the local name.
 */
public final String getLocalName() {
  final byte[] name = getLocalNameBytes();
  return name == null? null: DFSUtil.bytes2String(name);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:INode.java

示例10: getLocalName

import org.apache.hadoop.hdfs.DFSUtil; //导入方法依赖的package包/类
/**
 * Get the string representation of the local name
 * @return the local name in string
 */
public final String getLocalName() {
  return DFSUtil.bytes2String(path);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:HdfsFileStatus.java

示例11: getSymlink

import org.apache.hadoop.hdfs.DFSUtil; //导入方法依赖的package包/类
/**
 * Get the string representation of the symlink.
 * @return the symlink as a string.
 */
public final String getSymlink() {
  return DFSUtil.bytes2String(symlink);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:HdfsFileStatus.java


注:本文中的org.apache.hadoop.hdfs.DFSUtil.bytes2String方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。