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
FieldsModifier and TypeFieldDescriptionstatic final intThe execute permission bit mask (UNIX0b001).static final intThe read permission bit mask (UNIX0b100).static final intThe write permission bit mask (UNIX0b010). -
Constructor Summary
ConstructorsConstructorDescriptionPermission(boolean read, boolean write, boolean execute) Creates an instance of aPermissionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull ArchiveEntry.Permissiondecode(int value) Decode the permission from the numeric value.final booleanIndicates whether some other object is "equal to" this one.booleanexecute()Returns the value of theexecuterecord component.final inthashCode()Returns a hash code value for this object.booleanread()Returns the value of thereadrecord component.@NonNull StringtoString()Returns a string representation of this record class.booleanwrite()Returns the value of thewriterecord component.
-
Field Details
-
READ_MASK
public static final int READ_MASKThe read permission bit mask (UNIX0b100).- See Also:
-
WRITE_MASK
public static final int WRITE_MASKThe write permission bit mask (UNIX0b010).- See Also:
-
EXECUTE_MASK
public static final int EXECUTE_MASKThe execute permission bit mask (UNIX0b001).- See Also:
-
-
Constructor Details
-
Method Details
-
decode
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
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. -
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. -
equals
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 '=='. -
read
public boolean read()Returns the value of thereadrecord component.- Returns:
- the value of the
readrecord component
-
write
public boolean write()Returns the value of thewriterecord component.- Returns:
- the value of the
writerecord component
-
execute
public boolean execute()Returns the value of theexecuterecord component.- Returns:
- the value of the
executerecord component
-