java.lang.Object
it.unimi.di.prog2.temisvolti.filesystem.Entry
it.unimi.di.prog2.temisvolti.filesystem.File

public class File extends Entry
Classe immutabile che rappresenta un file.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final int
    La dimensione del file.

    Fields inherited from class it.unimi.di.prog2.temisvolti.filesystem.Entry

    name
  • Constructor Summary

    Constructors
    Constructor
    Description
    File(String name, int size)
    Costruisce un file dato il suo nome e dimensione.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Consente di sapere se una entry è una directory.
    int
    Restituisce la dimensione dell'entry.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • size

      private final int size
      La dimensione del file.
  • Constructor Details

    • File

      public File(String name, int size)
      Costruisce un file dato il suo nome e dimensione.
      Parameters:
      name - il nome.
      size - la dimensione.
      Throws:
      IllegalArgumentException - se la dimensione non è positiva, o il nome è null o vuoto.
  • Method Details

    • size

      public int size()
      Description copied from class: Entry
      Restituisce la dimensione dell'entry.
      Specified by:
      size in class Entry
      Returns:
      la dimensione.
    • isDir

      public boolean isDir()
      Description copied from class: Entry
      Consente di sapere se una entry è una directory.
      Specified by:
      isDir in class Entry
      Returns:
      true sse l'entry è una directory.
    • toString

      public String toString()
      Overrides:
      toString in class Object