Enum Class DefaultFileSystem

java.lang.Object
java.lang.Enum<DefaultFileSystem>
ch.epfl.cs107.play.io.DefaultFileSystem
All Implemented Interfaces:
FileSystem, Serializable, Comparable<DefaultFileSystem>, Constable

public enum DefaultFileSystem extends Enum<DefaultFileSystem> implements FileSystem
Empty implementation of file system.
  • Enum Constant Details

  • Method Details

    • values

      public static DefaultFileSystem[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static DefaultFileSystem valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • read

      public InputStream read(String name) throws IOException
      Description copied from interface: FileSystem
      Open an existing file for read.
      Specified by:
      read in interface FileSystem
      Parameters:
      name - (String): unique identifier, not null
      Returns:
      (InputStream): content stream, not null
      Throws:
      IOException - if file cannot be open for read
    • write

      public OutputStream write(String name) throws IOException
      Description copied from interface: FileSystem
      Open file for write, previous content overwritten if any.
      Specified by:
      write in interface FileSystem
      Parameters:
      name - (String): unique identifier, not null
      Returns:
      (InputStream): content stream, not null
      Throws:
      IOException - if file cannot be open for write