public Path relativeTo(Path that) { int depthOfPathDivergence = depthOfPathDivergence(chunks, that.chunks); String[] result = new String[chunks.length + that.chunks.length - 2 * depthOfPathDivergence]; int count = 0; for (int i = depthOfPathDivergence; i < chunks.length; i++) { result[count++] = ".."; } for (int j = depthOfPathDivergence; j < that.chunks.length; j++) { result[count++] = that.chunks[j]; } if (count == 0) { return DOT; } else { return new Path(result); } }
/** * Current Path in stream. */ public Path getPath() { if (currentPath == null) { String[] chunks = new String[pointer + 1]; chunks[0] = ""; for (int i = -pointer; ++i <= 0; ) { final String name = peekElement(i); chunks[i + pointer] = name; } currentPath = new Path(chunks); } return currentPath; } }
protected Object getReferenceKey(String reference) { final Path path = new Path(isNameEncoding ? ((AbstractReader)reader.underlyingReader()).decodeNode(reference) : reference); // We have absolute references, if path starts with '/' return reference.charAt(0) != '/' ? pathTracker.getPath().apply(path) : path; }
public Path apply(Path relativePath) { FastStack absoluteStack = new FastStack(16); for (int i = 0; i < chunks.length; i++) { absoluteStack.push(chunks[i]); } for (int i = 0; i < relativePath.chunks.length; i++) { String relativeChunk = relativePath.chunks[i]; if (relativeChunk.equals("..")) { absoluteStack.pop(); } else if (!relativeChunk.equals(".")) { absoluteStack.push(relativeChunk); } } String[] result = new String[absoluteStack.size()]; for (int i = 0; i < result.length; i++) { result[i] = (String) absoluteStack.get(i); } return new Path(result); }
public Path relativeTo(Path that) { int depthOfPathDivergence = depthOfPathDivergence(chunks, that.chunks); String[] result = new String[chunks.length + that.chunks.length - 2 * depthOfPathDivergence]; int count = 0; for (int i = depthOfPathDivergence; i < chunks.length; i++) { result[count++] = ".."; } for (int j = depthOfPathDivergence; j < that.chunks.length; j++) { result[count++] = that.chunks[j]; } if (count == 0) { return DOT; } else { return new Path(result); } }
public Path relativeTo(Path that) { int depthOfPathDivergence = depthOfPathDivergence(chunks, that.chunks); String[] result = new String[chunks.length + that.chunks.length - 2 * depthOfPathDivergence]; int count = 0; for (int i = depthOfPathDivergence; i < chunks.length; i++) { result[count++] = ".."; } for (int j = depthOfPathDivergence; j < that.chunks.length; j++) { result[count++] = that.chunks[j]; } if (count == 0) { return DOT; } else { return new Path(result); } }
/** * Current Path in stream. */ public Path getPath() { if (currentPath == null) { String[] chunks = new String[pointer + 1]; chunks[0] = ""; for (int i = -pointer; ++i <= 0; ) { final String name = peekElement(i); chunks[i + pointer] = name; } currentPath = new Path(chunks); } return currentPath; } }
/** * Current Path in stream. */ public Path getPath() { if (currentPath == null) { final String[] chunks = new String[pointer + 1]; chunks[0] = ""; for (int i = -pointer; ++i <= 0;) { final String name = peekElement(i); chunks[i + pointer] = name; } currentPath = new Path(chunks); } return currentPath; } }
public Path relativeTo(Path that) { int depthOfPathDivergence = depthOfPathDivergence(chunks, that.chunks); String[] result = new String[chunks.length + that.chunks.length - 2 * depthOfPathDivergence]; int count = 0; for (int i = depthOfPathDivergence; i < chunks.length; i++) { result[count++] = ".."; } for (int j = depthOfPathDivergence; j < that.chunks.length; j++) { result[count++] = that.chunks[j]; } if (count == 0) { return DOT; } else { return new Path(result); } }
public Path relativeTo(Path that) { int depthOfPathDivergence = depthOfPathDivergence(chunks, that.chunks); String[] result = new String[chunks.length + that.chunks.length - 2 * depthOfPathDivergence]; int count = 0; for (int i = depthOfPathDivergence; i < chunks.length; i++) { result[count++] = ".."; } for (int j = depthOfPathDivergence; j < that.chunks.length; j++) { result[count++] = that.chunks[j]; } if (count == 0) { return DOT; } else { return new Path(result); } }
/** * Current Path in stream. */ public Path getPath() { if (currentPath == null) { String[] chunks = new String[pointer + 1]; chunks[0] = ""; for (int i = -pointer; ++i <= 0; ) { final String name = peekElement(i); chunks[i + pointer] = name; } currentPath = new Path(chunks); } return currentPath; } }
/** * Current Path in stream. */ public Path getPath() { if (currentPath == null) { String[] chunks = new String[pointer + 1]; chunks[0] = ""; for (int i = -pointer; ++i <= 0; ) { final String name = peekElement(i); chunks[i + pointer] = name; } currentPath = new Path(chunks); } return currentPath; } }
@Override protected Path getReferenceKey(final String reference) { final Path path = new Path(isNameEncoding ? ((AbstractReader)reader.underlyingReader()).decodeNode(reference) : reference); // We have absolute references, if path starts with '/' return reference.charAt(0) != '/' ? pathTracker.getPath().apply(path) : path; }
protected Object getReferenceKey(String reference) { final Path path = new Path(isXmlFriendly ? ((XmlFriendlyReader)reader.underlyingReader()).unescapeXmlName(reference) : reference); // We have absolute references, if path starts with '/' return reference.charAt(0) != '/' ? pathTracker.getPath().apply(path) : path; }
protected Object getReferenceKey(String reference) { final Path path = new Path(isNameEncoding ? ((AbstractReader)reader.underlyingReader()).decodeNode(reference) : reference); // We have absolute references, if path starts with '/' return reference.charAt(0) != '/' ? pathTracker.getPath().apply(path) : path; }
protected Object getReferenceKey(String reference) { final Path path = new Path(isNameEncoding ? ((AbstractReader)reader.underlyingReader()).decodeNode(reference) : reference); // We have absolute references, if path starts with '/' return reference.charAt(0) != '/' ? pathTracker.getPath().apply(path) : path; }
protected Object getReferenceKey(String reference) { final Path path = new Path(isXmlFriendly ? ((XmlFriendlyReader)reader.underlyingReader()).unescapeXmlName(reference) : reference); // We have absolute references, if path starts with '/' return reference.charAt(0) != '/' ? pathTracker.getPath().apply(path) : path; }
protected Object getReferenceKey(String reference) { final Path path = new Path(isNameEncoding ? ((AbstractReader)reader.underlyingReader()).decodeNode(reference) : reference); // We have absolute references, if path starts with '/' return reference.charAt(0) != '/' ? pathTracker.getPath().apply(path) : path; }
protected Object getReferenceKey(String reference) { final Path path = new Path(isNameEncoding ? ((AbstractReader)reader.underlyingReader()).decodeNode(reference) : reference); // We have absolute references, if path starts with '/' return reference.charAt(0) != '/' ? pathTracker.getPath().apply(path) : path; }
protected Object getReferenceKey(String reference) { final Path path = new Path(isNameEncoding ? ((AbstractReader)reader.underlyingReader()).decodeNode(reference) : reference); // We have absolute references, if path starts with '/' return reference.charAt(0) != '/' ? pathTracker.getPath().apply(path) : path; }