Class Mode


  • @PublicApi
    @NotThreadSafe
    public final class Mode
    extends java.lang.Object
    POSIX style file/directory access mode.
    • Constructor Detail

      • Mode

        public Mode​(short mode)
        Constructs an instance of Mode with the given mode.
        Parameters:
        mode - the digital representation of a Mode
        See Also:
        toShort()
      • Mode

        public Mode​(Mode mode)
        Copy constructor.
        Parameters:
        mode - another Mode
    • Method Detail

      • defaults

        public static Mode defaults()
        Gets the default mode.
        Returns:
        the default Mode
      • createNoAccess

        public static Mode createNoAccess()
        Creates the "no access" mode.
        Returns:
        the none Mode
      • createFullAccess

        public static Mode createFullAccess()
        Creates the "full access" mode.
        Returns:
        the none Mode
      • and

        public static Mode and​(Mode mode1,
                               Mode mode2)
        Parameters:
        mode1 - first mode of the and operation
        mode2 - second mode of the and operation
        Returns:
        the AND result of the two Modes
      • extractOwnerBits

        public static Mode.Bits extractOwnerBits​(short mode)
        Parameters:
        mode - the digital representation of a Mode
        Returns:
        the owner Mode.Bits
      • setOwnerBits

        public void setOwnerBits​(Mode.Bits bits)
        Sets owner bits.
        Parameters:
        bits - the owner bits to set
      • extractGroupBits

        public static Mode.Bits extractGroupBits​(short mode)
        Parameters:
        mode - the digital representation of a Mode
        Returns:
        the group Mode.Bits
      • setGroupBits

        public void setGroupBits​(Mode.Bits bits)
        Sets group bits.
        Parameters:
        bits - the group bits to set
      • extractOtherBits

        public static Mode.Bits extractOtherBits​(short mode)
        Parameters:
        mode - the digital representation of a Mode
        Returns:
        the other Mode.Bits
      • setOtherBits

        public void setOtherBits​(Mode.Bits bits)
        Sets other bits.
        Parameters:
        bits - the other bits to set
      • fromShort

        public void fromShort​(short n)
        Sets Mode bits using a digital representation.
        Parameters:
        n - the digital representation of a Mode
      • toShort

        public short toShort()
        Encodes the object as a short.
        Returns:
        the digital representation of this Mode
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • fromProto

        public static Mode fromProto​(alluxio.grpc.PMode pMode)
        Creates Mode from proto PMode.
        Parameters:
        pMode - proto mode
        Returns:
        created mode
      • toProto

        public alluxio.grpc.PMode toProto()
        Returns:
        proto representation of this mode instance