Class UfsStatus

  • Direct Known Subclasses:
    UfsDirectoryStatus, UfsFileStatus

    @NotThreadSafe
    public abstract class UfsStatus
    extends java.lang.Object
    Information about a file or a directory in the under file system. Listing contents in a UnderFileSystem returns entries of this class.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.String mGroup  
      protected boolean mIsDirectory  
      protected java.lang.Long mLastModifiedTimeMs
      Last modified epoch time in ms, or null if it is not available.
      protected short mMode  
      protected java.lang.String mName  
      protected java.lang.String mOwner  
      protected java.util.Map<java.lang.String,​byte[]> mXAttr  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected UfsStatus​(UfsStatus status)
      Creates a new instance of UfsStatus as a copy.
      protected UfsStatus​(java.lang.String name, boolean isDirectory, java.lang.String owner, java.lang.String group, short mode, java.lang.Long lastModifiedTimeMs, java.util.Map<java.lang.String,​byte[]> xAttrs)
      Creates new instance of UfsStatus.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String[] convertToNames​(UfsStatus[] children)
      Converts an array of UFS file status to a listing result where each element in the array is a file or directory name.
      abstract UfsStatus copy()
      Create a copy of UfsStatus.
      boolean equals​(java.lang.Object o)  
      java.lang.String getGroup()
      Gets the group of the given path.
      java.lang.Long getLastModifiedTime()
      Gets the UTC time of when the indicated path was modified recently in ms, or null if the last modified time is not available.
      short getMode()
      Gets the mode of the given path in short format, e.g 0700.
      java.lang.String getName()  
      java.lang.String getOwner()
      Gets the owner of the given path.
      java.util.Map<java.lang.String,​byte[]> getXAttr()
      Returns the extended attributes from the Ufs, if any.
      int hashCode()  
      boolean isDirectory()  
      boolean isFile()  
      UfsStatus setName​(java.lang.String name)
      Set the name of file or directory.
      protected com.google.common.base.MoreObjects.ToStringHelper toStringHelper()  
      • Methods inherited from class java.lang.Object

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

      • mIsDirectory

        protected final boolean mIsDirectory
      • mLastModifiedTimeMs

        protected final java.lang.Long mLastModifiedTimeMs
        Last modified epoch time in ms, or null if it is not available.
      • mName

        protected java.lang.String mName
      • mOwner

        protected final java.lang.String mOwner
      • mGroup

        protected final java.lang.String mGroup
      • mMode

        protected final short mMode
      • mXAttr

        protected final java.util.Map<java.lang.String,​byte[]> mXAttr
    • Constructor Detail

      • UfsStatus

        protected UfsStatus​(java.lang.String name,
                            boolean isDirectory,
                            java.lang.String owner,
                            java.lang.String group,
                            short mode,
                            @Nullable
                            java.lang.Long lastModifiedTimeMs,
                            @Nullable
                            java.util.Map<java.lang.String,​byte[]> xAttrs)
        Creates new instance of UfsStatus.
        Parameters:
        name - relative path of file or directory
        isDirectory - whether the path is a directory
        owner - of the file
        group - of the file
        mode - of the file
        lastModifiedTimeMs - last modified epoch time in ms, or null if it is not available
        xAttrs - any extended attributes on the inode
      • UfsStatus

        protected UfsStatus​(UfsStatus status)
        Creates a new instance of UfsStatus as a copy.
        Parameters:
        status - file information to copy
    • Method Detail

      • copy

        public abstract UfsStatus copy()
        Create a copy of UfsStatus.
        Returns:
        new instance as a copy
      • convertToNames

        @Nullable
        public static java.lang.String[] convertToNames​(UfsStatus[] children)
        Converts an array of UFS file status to a listing result where each element in the array is a file or directory name.
        Parameters:
        children - array of listing statuses
        Returns:
        array of file or directory names, or null if the input is null
      • isDirectory

        public boolean isDirectory()
        Returns:
        true, if the path is a directory
      • isFile

        public boolean isFile()
        Returns:
        true, if the path is a file
      • getGroup

        public java.lang.String getGroup()
        Gets the group of the given path.
        Returns:
        the group of the file
      • getLastModifiedTime

        @Nullable
        public java.lang.Long getLastModifiedTime()
        Gets the UTC time of when the indicated path was modified recently in ms, or null if the last modified time is not available.
        Returns:
        modification time in milliseconds
      • getMode

        public short getMode()
        Gets the mode of the given path in short format, e.g 0700.
        Returns:
        the mode of the file
      • getName

        public java.lang.String getName()
        Returns:
        name of file or directory
      • getOwner

        public java.lang.String getOwner()
        Gets the owner of the given path.
        Returns:
        the owner of the path
      • getXAttr

        @Nullable
        public java.util.Map<java.lang.String,​byte[]> getXAttr()
        Returns the extended attributes from the Ufs, if any.
        Returns:
        a map of the extended attributes. If none, the map will be empty
      • hashCode

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

        public UfsStatus setName​(java.lang.String name)
        Set the name of file or directory.
        Parameters:
        name - of entry
        Returns:
        this object
      • toStringHelper

        protected com.google.common.base.MoreObjects.ToStringHelper toStringHelper()
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object