public static URI getPivotURI(URI uri) { String oldScheme = uri.scheme(); if (oldScheme == null) { oldScheme = "null"; } String[] oldSegments = uri.segments(); String[] newSegments = new String[oldSegments.length + 1]; newSegments[0] = oldScheme; System.arraycopy(oldSegments, 0, newSegments, 1, oldSegments.length); URI pivotURI = URI.createHierarchicalURI( SCHEME_PIVOT, uri.authority(), uri.device(), newSegments, uri.query(), uri.fragment()); return pivotURI; }
public static URI getNonPivotURI(URI uri) { assert isPivotURI(uri); String[] oldSegments = uri.segments(); String[] newSegments = new String[oldSegments.length - 1]; newSegments[0] = uri.scheme(); System.arraycopy(oldSegments, 1, newSegments, 0, oldSegments.length - 1); URI pivotURI = URI.createHierarchicalURI( oldSegments[0], uri.authority(), uri.device(), newSegments, uri.query(), uri.fragment()); return pivotURI; }
public static void dumpURI(URI uri, Logger logger) { logger.debug("URI: " + uri); logger.debug("authority: " + uri.authority()); logger.debug("device: " + uri.device()); logger.debug("devicePath: " + uri.devicePath()); logger.debug("fileExtension: " + uri.fileExtension()); logger.debug("fragment: " + uri.fragment()); logger.debug("host: " + uri.host()); logger.debug("lastSegment: " + uri.lastSegment()); logger.debug("opaquePart: " + uri.opaquePart()); logger.debug("path: " + uri.path()); logger.debug("port: " + uri.port()); logger.debug("query: " + uri.query()); logger.debug("scheme: " + uri.scheme()); logger.debug("segmentCount: " + uri.segmentCount()); logger.debug("toFileString: " + uri.toFileString()); logger.debug("userInfo: " + uri.userInfo()); logger.debug("hasAbsolutePath: " + uri.hasAbsolutePath()); logger.debug("schemehasAbsolutePath: " + uri.hasAbsolutePath()); logger.debug("hasAuthority: " + uri.hasAuthority()); logger.debug("hasDevice: " + uri.hasDevice()); logger.debug("hasEmptyPath: " + uri.hasEmptyPath()); logger.debug("hasFragment: " + uri.hasFragment()); logger.debug("hasOpaquePart: " + uri.hasOpaquePart()); logger.debug("hasPath: " + uri.hasPath()); logger.debug("hasQuery: " + uri.hasQuery()); logger.debug("hasRelativePath: " + uri.hasRelativePath()); logger.debug("hasTrailingPathSeparator: " + uri.hasTrailingPathSeparator()); logger.debug("isCurrentDocumentReference: " + uri.isCurrentDocumentReference()); logger.debug("isEmpty: " + uri.isEmpty()); logger.debug("isFile: " + uri.isFile()); logger.debug("isHierarchical: " + uri.isHierarchical()); logger.debug("isPrefix: " + uri.isPrefix()); logger.debug("isRelative: " + uri.isRelative()); logger.debug("segments: " + uri.segments()); }