/** @return the full path in string form */ public String getPath() { if (pathname == null) { pathname = DFSUtil.byteArray2PathString(path); } return pathname; }
public static String byteArray2PathString(byte[][] pathComponents) { return byteArray2PathString(pathComponents, 0, pathComponents.length); }
private static String getPath(byte[][] components, int start, int end) { return DFSUtil.byteArray2PathString(components, start, end - start + 1); }
public String getPath(int pos) { return DFSUtil.byteArray2PathString(path, 0, pos + 1); // it's a length... }
/** Convert an object representing a path to a string. */ public static String path2String(final Object path) { return path == null? null : path instanceof String? (String)path : path instanceof byte[][]? byteArray2PathString((byte[][])path) : path.toString(); }
private static byte[][] constructRemainingPath(byte[][] components, byte[][] extraComponents, int startAt) { int remainder = extraComponents.length - startAt; if (remainder > 0) { // grow the array and copy in the remaining components int pos = components.length; components = Arrays.copyOf(components, pos + remainder); System.arraycopy(extraComponents, startAt, components, pos, remainder); } if (NameNode.LOG.isDebugEnabled()) { NameNode.LOG.debug( "Resolved path is " + DFSUtil.byteArray2PathString(components)); } return components; }
static String resolvePath(String src, FSDirectory fsd) throws FileNotFoundException { byte[][] pathComponents = INode.getPathComponents(src); pathComponents = resolveComponents(pathComponents, fsd); return DFSUtil.byteArray2PathString(pathComponents); }
} catch (NumberFormatException e) { throw new FileNotFoundException("Invalid inode path: " + DFSUtil.byteArray2PathString(pathComponents)); throw new FileNotFoundException( "File for given inode path does not exist: " + DFSUtil.byteArray2PathString(pathComponents));
(pathComponents[j], getLayoutVersion()); if (!Arrays.equals(newComponent, pathComponents[j])) { String oldPath = DFSUtil.byteArray2PathString(pathComponents); pathComponents[j] = newComponent; String newPath = DFSUtil.byteArray2PathString(pathComponents); LOG.info("Renaming reserved path " + oldPath + " to " + newPath);
/** @return the full path in string form */ public String getPath() { if (pathname == null) { pathname = DFSUtil.byteArray2PathString(path); } return pathname; }
public String getPath(int pos) { return DFSUtil.byteArray2PathString(path, 0, pos + 1); // it's a length... }
/** Convert an object representing a path to a string. */ public static String path2String(final Object path) { return path == null? null : path instanceof String? (String)path : path instanceof byte[][]? byteArray2PathString((byte[][])path) : path.toString(); }
/** Convert an object representing a path to a string. */ public static String path2String(final Object path) { return path == null? null : path instanceof String? (String)path : path instanceof byte[][]? byteArray2PathString((byte[][])path) : path.toString(); }
Arrays.copyOf(components, components.length - 1); componentsCopy[count] = DFSUtil.string2Bytes( DFSUtil.byteArray2PathString(components, count, 2));
private static String constructPath(INodeAttributes[] inodes, int end) { byte[][] components = new byte[end+1][]; for (int i=0; i <= end; i++) { components[i] = inodes[i].getLocalNameBytes(); } return DFSUtil.byteArray2PathString(components); }
private static String constructPath(INodeAttributes[] inodes, int end) { byte[][] components = new byte[end+1][]; for (int i=0; i <= end; i++) { components[i] = inodes[i].getLocalNameBytes(); } return DFSUtil.byteArray2PathString(components); }
static String resolvePath(String src, FSDirectory fsd) throws FileNotFoundException { byte[][] pathComponents = INode.getPathComponents(src); pathComponents = resolveComponents(pathComponents, fsd); return DFSUtil.byteArray2PathString(pathComponents); }
static String resolvePath(String src, FSDirectory fsd) throws FileNotFoundException { byte[][] pathComponents = INode.getPathComponents(src); pathComponents = resolveComponents(pathComponents, fsd); return DFSUtil.byteArray2PathString(pathComponents); }
@Test public void testByteArray2PathStringFQ() { byte[][] components = DFSUtil.getPathComponents("/1/2/3"); assertEquals("/1/2/3", DFSUtil.byteArray2PathString(components)); assertEquals("", DFSUtil.byteArray2PathString(components, 0, 0)); assertEquals("/", DFSUtil.byteArray2PathString(components, 0, 1)); assertEquals("/1", DFSUtil.byteArray2PathString(components, 0, 2)); assertEquals("/1/2", DFSUtil.byteArray2PathString(components, 0, 3)); assertEquals("/1/2/3", DFSUtil.byteArray2PathString(components, 0, 4)); assertEquals("", DFSUtil.byteArray2PathString(components, 1, 0)); assertEquals("1", DFSUtil.byteArray2PathString(components, 1, 1)); assertEquals("1/2", DFSUtil.byteArray2PathString(components, 1, 2)); assertEquals("1/2/3", DFSUtil.byteArray2PathString(components, 1, 3)); }
@Test public void testByteArray2PathStringRoot() { byte[][] components = DFSUtil.getPathComponents("/"); assertEquals("", DFSUtil.byteArray2PathString(components, 0, 0)); assertEquals("/", DFSUtil.byteArray2PathString(components, 0, 1)); }