Class Fingerprint


  • @NotThreadSafe
    public final class Fingerprint
    extends java.lang.Object
    Fingerprint for a UFS file or directory.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Fingerprint.Tag
      The possible tags within the fingerprint.
      static class  Fingerprint.Type
      The possible types of the fingerprint.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static Fingerprint create​(java.lang.String ufsName, UfsStatus status)
      Parses the input string and returns the fingerprint object.
      static Fingerprint create​(java.lang.String ufsName, UfsStatus status, java.lang.String contentHash)
      Parses the input string and returns the fingerprint object.
      static Fingerprint create​(java.lang.String ufsName, UfsStatus status, java.lang.String contentHash, AccessControlList acl)
      Parses the input string and returns the fingerprint object.
      java.lang.String getTag​(Fingerprint.Tag tag)  
      boolean isValid()
      Checks if the fingerprint object was generated from an INVALID_UFS_FINGERPRINT.
      boolean matchContent​(Fingerprint fp)
      Returns true if the serialized fingerprint matches the fingerprint in the content part.
      boolean matchMetadata​(Fingerprint fp)
      Returns true if the serialized fingerprint matches the fingerprint in metadata.
      static Fingerprint parse​(java.lang.String input)
      Parses the input string and returns the fingerprint object.
      void putTag​(Fingerprint.Tag tag, java.lang.String value)
      Updates a specific tag in the fingerprint.
      java.lang.String serialize()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • INVALID_FINGERPRINT

        public static final Fingerprint INVALID_FINGERPRINT
    • Method Detail

      • create

        public static Fingerprint create​(java.lang.String ufsName,
                                         UfsStatus status)
        Parses the input string and returns the fingerprint object.
        Parameters:
        ufsName - the name of the ufs, should be UnderFileSystem.getUnderFSType()
        status - the UfsStatus to create the fingerprint from
        Returns:
        the fingerprint object
      • create

        public static Fingerprint create​(java.lang.String ufsName,
                                         UfsStatus status,
                                         @Nullable
                                         java.lang.String contentHash)
        Parses the input string and returns the fingerprint object.
        Parameters:
        ufsName - the name of the ufs, should be UnderFileSystem.getUnderFSType()
        status - the UfsStatus to create the fingerprint from
        contentHash - the hash of the contents, if null the hash will be taken from the UfsStatus parameter
        Returns:
        the fingerprint object
      • create

        public static Fingerprint create​(java.lang.String ufsName,
                                         UfsStatus status,
                                         @Nullable
                                         java.lang.String contentHash,
                                         @Nullable
                                         AccessControlList acl)
        Parses the input string and returns the fingerprint object.
        Parameters:
        ufsName - the name of the ufs, should be UnderFileSystem.getUnderFSType()
        status - the UfsStatus to create the fingerprint from
        contentHash - the hash of the contents, if null the hash will be taken from the UfsStatus parameter
        acl - the AccessControlList to create the fingerprint from
        Returns:
        the fingerprint object
      • parse

        @Nullable
        public static Fingerprint parse​(java.lang.String input)
        Parses the input string and returns the fingerprint object.
        Parameters:
        input - the string to parse
        Returns:
        the parsed fingerprint object, or null if parsing failed
      • isValid

        public boolean isValid()
        Checks if the fingerprint object was generated from an INVALID_UFS_FINGERPRINT.
        Returns:
        returns true if the fingerprint is valid
      • serialize

        public java.lang.String serialize()
        Returns:
        the serialized string of the fingerprint
      • matchMetadata

        public boolean matchMetadata​(Fingerprint fp)
        Returns true if the serialized fingerprint matches the fingerprint in metadata.
        Parameters:
        fp - a parsed fingerprint object
        Returns:
        true if the given fingerprint matches the current fingerprint in metadata
      • matchContent

        public boolean matchContent​(Fingerprint fp)
        Returns true if the serialized fingerprint matches the fingerprint in the content part.
        Parameters:
        fp - a parsed fingerprint object
        Returns:
        true if the given fingerprint matches the current fingerprint's content
      • putTag

        public void putTag​(Fingerprint.Tag tag,
                           java.lang.String value)
        Updates a specific tag in the fingerprint. If the new value is null, the fingerprint is kept unchanged.
        Parameters:
        tag - the tag to update
        value - the new value of the tag
      • getTag

        public java.lang.String getTag​(Fingerprint.Tag tag)
        Parameters:
        tag - the tag to get
        Returns:
        the value of the tag