Record Class ArchiveEntry.Permission

java.lang.Object
java.lang.Record
xyz.apollosoftware.bibliothiki.compression.ArchiveEntry.Permission
Record Components:
read - Whether read permission is granted.
write - Whether write permission is granted.
execute - Whether execute permission is granted.
Enclosing class:
ArchiveEntry

public static record ArchiveEntry.Permission(boolean read, boolean write, boolean execute) extends Record
Permission flags for a single target (e.g., user, group or world).

In a UNIX file permissions value, this is represented by a single octal digit.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The execute permission bit mask (UNIX 0b001).
    static final int
    The read permission bit mask (UNIX 0b100).
    static final int
    The write permission bit mask (UNIX 0b010).
  • Constructor Summary

    Constructors
    Constructor
    Description
    Permission(boolean read, boolean write, boolean execute)
    Creates an instance of a Permission record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    static @NonNull ArchiveEntry.Permission
    decode(int value)
    Decode the permission from the numeric value.
    final boolean
    Indicates whether some other object is "equal to" this one.
    boolean
    Returns the value of the execute record component.
    final int
    Returns a hash code value for this object.
    boolean
    Returns the value of the read record component.
    @NonNull String
    Returns a string representation of this record class.
    boolean
    Returns the value of the write record component.

    Methods inherited from class java.lang.Object

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

    • READ_MASK

      public static final int READ_MASK
      The read permission bit mask (UNIX 0b100).
      See Also:
    • WRITE_MASK

      public static final int WRITE_MASK
      The write permission bit mask (UNIX 0b010).
      See Also:
    • EXECUTE_MASK

      public static final int EXECUTE_MASK
      The execute permission bit mask (UNIX 0b001).
      See Also:
  • Constructor Details

    • Permission

      public Permission(boolean read, boolean write, boolean execute)
      Creates an instance of a Permission record class.
      Parameters:
      read - the value for the read record component
      write - the value for the write record component
      execute - the value for the execute record component
  • Method Details

    • decode

      public static @NonNull ArchiveEntry.Permission decode(int value)
      Decode the permission from the numeric value.

      This method assumes that any necessary shifts have already been performed (i.e., the only bits that should be set are the lower three octets).

      Parameters:
      value - The value to decode.
      Returns:
      The decoded value.
    • toString

      public @NonNull String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • read

      public boolean read()
      Returns the value of the read record component.
      Returns:
      the value of the read record component
    • write

      public boolean write()
      Returns the value of the write record component.
      Returns:
      the value of the write record component
    • execute

      public boolean execute()
      Returns the value of the execute record component.
      Returns:
      the value of the execute record component