private Directory(int id) { super(id); put(new DirectoryEntry(this, Name.SELF, this)); }
private Directory(int id, Name rootName) { this(id); linked(new DirectoryEntry(this, rootName, this)); }
@Override void linked(DirectoryEntry entry) { File parent = entry.directory(); // handles null check this.entryInParent = entry; forcePut(new DirectoryEntry(this, Name.PARENT, parent)); }
/** * Links the given name to the given file in this directory. * * @throws IllegalArgumentException if {@code name} is a reserved name such as "." or if an * entry already exists for the name */ public void link(Name name, File file) { DirectoryEntry entry = new DirectoryEntry(this, checkNotReserved(name, "link"), file); put(entry); file.linked(entry); }
/** * Looks up the last element of a path. */ @Nullable private DirectoryEntry lookUpLast( @Nullable File dir, Name name, Set<? super LinkOption> options, int linkDepth) throws IOException { Directory directory = toDirectory(dir); if (directory == null) { return null; } DirectoryEntry entry = directory.get(name); if (entry == null) { return new DirectoryEntry(directory, name, null); } File file = entry.file(); if (!options.contains(LinkOption.NOFOLLOW_LINKS) && file.isSymbolicLink()) { return followSymbolicLink(dir, (SymbolicLink) file, linkDepth); } return getRealEntry(entry); }
private Directory(int id) { super(id); put(new DirectoryEntry(this, Name.SELF, this)); }
private Directory(int id, Name rootName) { this(id); linked(new DirectoryEntry(this, rootName, this)); }
@Override void linked(DirectoryEntry entry) { File parent = entry.directory(); // handles null check this.entryInParent = entry; forcePut(new DirectoryEntry(this, Name.PARENT, parent)); }
/** * Links the given name to the given file in this directory. * * @throws IllegalArgumentException if {@code name} is a reserved name such as "." or if an * entry already exists for the name */ public void link(Name name, File file) { DirectoryEntry entry = new DirectoryEntry(this, checkNotReserved(name, "link"), file); put(entry); file.linked(entry); }
/** * Looks up the last element of a path. */ @Nullable private DirectoryEntry lookUpLast( @Nullable File dir, Name name, Set<? super LinkOption> options, int linkDepth) throws IOException { Directory directory = toDirectory(dir); if (directory == null) { return null; } DirectoryEntry entry = directory.get(name); if (entry == null) { return new DirectoryEntry(directory, name, null); } File file = entry.file(); if (!options.contains(LinkOption.NOFOLLOW_LINKS) && file.isSymbolicLink()) { return followSymbolicLink(dir, (SymbolicLink) file, linkDepth); } return getRealEntry(entry); }