private boolean invariants() { assert null != getUri(); assert getUri().isAbsolute(); assert null == getUri().getRawQuery(); assert null == getUri().getRawFragment(); if (getUri().isOpaque()) { assert getUri().getRawSchemeSpecificPart().endsWith(SEPARATOR); final FsNodePath path = getPath(); assert null != path; assert path.getUri().isAbsolute(); assert null == path.getUri().getRawFragment(); assert 0 != path.getNodeName().getUri().getRawPath().length(); } else { assert getUri().normalize() == getUri(); assert getUri().getRawPath().endsWith(FsNodeName.SEPARATOR); assert null == getPath(); } return true; }
/** * Returns the nullable parent of the given file system node path. * * @param path a file system node path. * @return The parent file system node path or null if {@code path} does * not name a parent. * @throws URISyntaxException */ static @Nullable FsNodePath parent(FsNodePath path) throws URISyntaxException { FsMountPoint mp = path.getMountPoint(); FsNodeName en = path.getNodeName(); if (en.isRoot()) { if (null == mp) return null; path = mp.getPath(); if (null != path) return parent(path); URI mpu = mp.getUri(); URI pu = mpu.resolve(DOT_DOT_URI); if (mpu.getRawPath().length() <= pu.getRawPath().length()) return null; return new FsNodePath(pu); } else { URI pu = en.getUri().resolve(DOT_URI); en = new FsNodeName(pu, CANONICALIZE); return new FsNodePath(mp, en); } } }
@SuppressWarnings("LeakingThisInConstructor") private TFile( final FsMountPoint mountPoint, final TArchiveDetector detector) { super(mountPoint.toHierarchicalUri()); this.file = new File(super.getPath()); this.detector = detector; final FsNodePath mpp = mountPoint.getPath(); if (null == mpp) { assert !mountPoint.getUri().isOpaque(); this.enclArchive = null; this.nodeName = null; this.innerArchive = null; } else { assert mountPoint.getUri().isOpaque(); if (mpp.getUri().isOpaque()) { this.enclArchive = new TFile(mpp.getMountPoint(), detector); this.nodeName = mpp.getNodeName(); } else { this.enclArchive = null; this.nodeName = null; } this.innerArchive = this; this.controller = getController(mountPoint); } assert invariants(); }
this.detector = detector; final FsMountPoint mp = path.getMountPoint(); final FsNodePath mpp = mp.getPath(); final FsNodeName nn; if (null == mpp) {
if (null != pmp) { mp = pmp; en = mmp.getPath().getNodeName(); } else { mp = mmp;
@Override public void checkAccess( final BitField<FsAccessOption> options, final FsNodeName name, final BitField<Access> types) throws IOException { try { controller.checkAccess(options, name, types); } catch (final ControlFlowException ex) { if (!name.isRoot() || null == findKeyException(ex)) throw ex; getParent().checkAccess( options, getModel() .getMountPoint() .getPath() .resolve(name) .getNodeName(), types); } }
options, getModel() .getMountPoint() .getPath() .resolve(name) .getNodeName());