Interface BrowsableLocation

  • All Superinterfaces:
    Location
    All Known Implementing Classes:
    FileLocation

    public interface BrowsableLocation
    extends Location
    A Location that offers methods to browse other locations relative to it.
    Author:
    Gabriel Einsdorf, Curtis Rueden
    • Method Detail

      • parent

        BrowsableLocation parent()
                          throws IOException
        Obtains a location pointing to the parent directory of this one.
        Returns:
        the parent location of this one, or null if this location has no parent.
        Throws:
        IOException - if something goes wrong obtaining the parent.
      • sibling

        BrowsableLocation sibling​(String path)
                           throws IOException
        Obtains a location relative to this one, which will be configured like the current location, but point to a the file specified by the path parameter.
        Parameters:
        path - the relative path of the desired location.
        Returns:
        A location that points to the specified file location.
        Throws:
        IOException - if something goes wrong obtaining the sibling
      • isDirectory

        boolean isDirectory()
        Tests whether this location is a directory, meaning that it can have children. It is recommended to use this method before calling child(String) or children(), to ensure those calls succeed.
        Returns:
        True iff the location represents a directory.
      • child

        BrowsableLocation child​(String name)
                         throws IOException
        Obtains a location with the given name, for whom this location is the parent. Note that this will only succeed if calls to isDirectory() on this location return true.
        Parameters:
        name - the name of the child
        Returns:
        a location pointing to the child
        Throws:
        IOException - if something goes wrong obtaining the child.
        IllegalArgumentException - if this location is not a directory (i.e., isDirectory() returns false).