1 /* 2 * Copyright (C) 2005-2015 Schlichtherle IT Services. 3 * All rights reserved. Use is subject to license terms. 4 */ 5 package net.java.truevfs.kernel.spec; 6 7 import java.util.Set; 8 import javax.annotation.Nullable; 9 import net.java.truecommons.cio.Entry; 10 import net.java.truecommons.shed.BitField; 11 import net.java.truecommons.shed.ImplementationsShouldExtend; 12 13 /** 14 * A file system node is an entry which can implement multiple entry types and 15 * list directory members. 16 * 17 * @author Christian Schlichtherle 18 */ 19 @ImplementationsShouldExtend(FsAbstractNode.class) 20 public interface FsNode extends Entry { 21 22 /** 23 * Returns a string representation of the 24 * {@link FsNodeName file system node name}. 25 * 26 * @return A string representation of the 27 * {@link FsNodeName file system node name}. 28 */ 29 @Override 30 String getName(); 31 32 /** 33 * Returns a bit field of types implemented by this file system node. 34 * <p> 35 * Some file system types allow a node to implement multiple types. 36 * For example, a ZIP or TAR file may contain an archive entry with the 37 * name {@code foo} and a directory archive entry with the name {@code foo/}. 38 * Yes, this is strange, but sh*t happens! 39 * In this case then, a virtual file system should collapse this into one 40 * file system node which returns {@code true} for both 41 * {@code isType(FILE)} and {@code isType(DIRECTORY)}. 42 * 43 * @return A bit field of types implemented by this file system node. 44 */ 45 BitField<Type> getTypes(); 46 47 /** 48 * Returns {@code true} if and only if this file system node implements 49 * the given type. 50 * 51 * @param type the type to test. 52 * @return {@code true} if and only if this file system node implements 53 * the given type. 54 * @see #getTypes() 55 */ 56 boolean isType(Type type); 57 58 /** 59 * Returns a set of strings with the base names of the members of this 60 * directory node or {@code null} if and only if this is not a directory 61 * node. 62 * Whether or not modifying the returned set is supported and the effect 63 * on the file system is implementation specific. 64 * 65 * @return A set of strings with the base names of the members of this 66 * directory node or {@code null} if and only if this is not a 67 * directory node. 68 */ 69 @Nullable Set<String> getMembers(); 70 }