@Test public void testPathNormalisation() { Path path = new Path(" assertEquals("/a/c", path.toString()); }
@Override public String toString() { final int resultSize = computeLength(); if (resultSize <= 0) { return ""; } char[] result = new char[resultSize]; int offset = 0; if ((separators & HAS_LEADING) != 0) { result[offset++] = SEPARATOR; } final int len = segments.length - 1; if (len >= 0) { for (int i = 0; i < len; i++) { final int size = segments[i].length(); segments[i].getChars(0, size, result, offset); offset += size; result[offset++] = SEPARATOR; } final int size = segments[len].length(); segments[len].getChars(0, size, result, offset); offset += size; } if ((separators & HAS_TRAILING) != 0) { result[offset] = SEPARATOR; } return new String(result); }
Path implements Serializable { @Override public String toString() { final int resultSize = computeLength(); if (resultSize <= 0) { return ""; } char[] result = new char[resultSize]; int offset = 0; if ((separators & HAS_LEADING) != 0) { result[offset++] = SEPARATOR; } final int len = segments.length - 1; if (len >= 0) { for (int i = 0; i < len; i++) { final int size = segments[i].length(); segments[i].getChars(0, size, result, offset); offset += size; result[offset++] = SEPARATOR; } final int size = segments[len].length(); segments[len].getChars(0, size, result, offset); offset += size; } if ((separators & HAS_TRAILING) != 0) { result[offset] = SEPARATOR; } return new String(result); } }
Path implements Serializable { @Override public String toString() { final int resultSize = computeLength(); if (resultSize <= 0) { return ""; } char[] result = new char[resultSize]; int offset = 0; if ((separators & HAS_LEADING) != 0) { result[offset++] = SEPARATOR; } final int len = segments.length - 1; if (len >= 0) { for (int i = 0; i < len; i++) { final int size = segments[i].length(); segments[i].getChars(0, size, result, offset); offset += size; result[offset++] = SEPARATOR; } final int size = segments[len].length(); segments[len].getChars(0, size, result, offset); offset += size; } if ((separators & HAS_TRAILING) != 0) { result[offset] = SEPARATOR; } return new String(result); } Path(String fullPath); private  Path(String[] segments, int separators); }
Path implements Serializable { @Override public String toString() { final int resultSize = computeLength(); if (resultSize <= 0) { return ""; } char[] result = new char[resultSize]; int offset = 0; if ((separators & HAS_LEADING) != 0) { result[offset++] = SEPARATOR; } final int len = segments.length - 1; if (len >= 0) { for (int i = 0; i < len; i++) { final int size = segments[i].length(); segments[i].getChars(0, size, result, offset); offset += size; result[offset++] = SEPARATOR; } final int size = segments[len].length(); segments[len].getChars(0, size, result, offset); offset += size; } if ((separators & HAS_TRAILING) != 0) { result[offset] = SEPARATOR; } return new String(result); } Path(String fullPath); private  Path(String[] segments, int separators); static Path createFromAbsolutePath(String path); static Path createFromSegments(String[] segments); Path addFileExtension(String extension); Path addTrailingSeparator(); Path append(Path tail); Path append(String tail); @Override boolean equals(Object obj); @Override int hashCode(); String getFileExtension(); boolean hasTrailingSeparator(); boolean isAbsolute(); boolean isEmpty(); boolean isPrefixOf(Path anotherPath); boolean isRoot(); static boolean isValidPath(String path); String lastSegment(); Path makeAbsolute(); Path makeRelative(); int matchingFirstSegments(Path anotherPath); Path removeFileExtension(); Path removeFirstSegments(int count); Path removeLastSegments(final int count); Path removeTrailingSeparator(); String segment(int index); int segmentCount(); String[] segments(); @Override String toString(); Path uptoSegment(final int count); static String getFileNameFromPath(String iconPath); }
Path implements Serializable { @Override public String toString() { final int resultSize = computeLength(); if (resultSize <= 0) { return ""; } char[] result = new char[resultSize]; int offset = 0; if ((separators & HAS_LEADING) != 0) { result[offset++] = SEPARATOR; } final int len = segments.length - 1; if (len >= 0) { for (int i = 0; i < len; i++) { final int size = segments[i].length(); segments[i].getChars(0, size, result, offset); offset += size; result[offset++] = SEPARATOR; } final int size = segments[len].length(); segments[len].getChars(0, size, result, offset); offset += size; } if ((separators & HAS_TRAILING) != 0) { result[offset] = SEPARATOR; } return new String(result); } Path(String fullPath); private  Path(String[] segments, int separators); static Path createFromAbsolutePath(String path); static Path createFromSegments(String[] segments); Path addFileExtension(String extension); Path addTrailingSeparator(); Path append(Path tail); Path append(String tail); @Override boolean equals(Object obj); @Override int hashCode(); String getFileExtension(); boolean hasTrailingSeparator(); boolean isAbsolute(); boolean isEmpty(); boolean isPrefixOf(Path anotherPath); boolean isRoot(); static boolean isValidPath(String path); String lastSegment(); Path makeAbsolute(); Path makeRelative(); int matchingFirstSegments(Path anotherPath); Path removeFileExtension(); Path removeFirstSegments(int count); Path removeLastSegments(final int count); Path removeTrailingSeparator(); String segment(int index); int segmentCount(); String[] segments(); @Override String toString(); Path uptoSegment(final int count); static String getFileNameFromPath(String iconPath);  }