Class FileListDataItem

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<unlimited.core.util.common.RemoteFileIfc>, unlimited.core.util.common.RemoteFileIfc
    Direct Known Subclasses:
    FCWebFileListDataItem

    public class FileListDataItem
    extends java.lang.Object
    implements java.io.Serializable, java.lang.Cloneable, unlimited.core.util.common.RemoteFileIfc
    This class represents an individual item from a set of remote list items. It provides access to the name, modified date, size (in bytes), and type if item.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int DIR
      Type returned by getType() if this item is a directory.
      static FileListDataItem EMPTY  
      static int FCWEBLINK
      Type returned by getType() if this item is a link.
      static int FILE
      Type returned by getType() if this item is a file.
      static int LINK
      Type returned by getType() if this item is a link.
      static int UNKNOWN
      Type returned by getType() if this item is a file.
    • Constructor Summary

      Constructors 
      Constructor Description
      FileListDataItem​(java.io.File file)
      Default constructor when a file is already known
      FileListDataItem​(java.lang.String name, long size, long modified, int type)
      Constructor when the data is already known
      FileListDataItem​(java.nio.file.Path file)
      Constructor when a Java.NIO Path object is known
      FileListDataItem​(FileSystemEvent event)
      Constructor used when a FileSystemEvent generates DataItems
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      FileListDataItem clone()  
      int compareTo​(unlimited.core.util.common.RemoteFileIfc item)  
      boolean equals​(java.lang.Object obj)  
      int getChildCount()
      Returns amount of children this item has
      long getModified()
      Returns the modified time (in millis since 1970).
      java.util.Date getModifiedDate()
      Returns a Date object representing the modified time of this item
      java.lang.String getModifiedFormatted()
      Returns a formated string representation of the modified date using the default locale.
      java.lang.String getName()
      Returns the filename for this item
      java.lang.String getRealPath()
      Returns the real path for this FileListDataItem
      java.lang.String getRelativePath​(java.io.File relativeTo)  
      java.lang.String getRelativePath​(java.nio.file.Path relativeTo)  
      long getSize()
      Returns the size (in bytes) of this item.
      int getType()
      Returns the type of this item.
      int hashCode()  
      boolean isDirectory()
      Returns true if this item is a directory
      boolean isFCWebLink()
      Returns true if this item is a symbolic link in FC Web
      boolean isFile()
      Returns true if this item is a file
      boolean isLink()
      Returns true if this item is a symbolic link
      void setChildCount​(int count)  
      void setModified​(long modified)
      Set the last modified timestamp to the value specified
      void setName​(java.lang.String name)
      Sets the data item name to the value specified
      void setRealPath​(java.lang.String realPath)
      Sets the real path of the item to the value specified
      void setSize​(long size)
      Sets the size of the item to the value provided
      void setType​(int type)
      Sets the type of the FileListDataItem to the value specified
      java.lang.String toString()
      Returns a String representation of this item.
      • Methods inherited from class java.lang.Object

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

      • UNKNOWN

        public static int UNKNOWN
        Type returned by getType() if this item is a file.
      • FILE

        public static int FILE
        Type returned by getType() if this item is a file.
      • DIR

        public static int DIR
        Type returned by getType() if this item is a directory.
      • LINK

        public static int LINK
        Type returned by getType() if this item is a link.
      • FCWEBLINK

        public static int FCWEBLINK
        Type returned by getType() if this item is a link.
    • Constructor Detail

      • FileListDataItem

        public FileListDataItem​(java.io.File file)
        Default constructor when a file is already known
        Parameters:
        file -
      • FileListDataItem

        public FileListDataItem​(java.nio.file.Path file)
                         throws java.io.IOException
        Constructor when a Java.NIO Path object is known
        Parameters:
        file - File to construct the DataItem from
        Throws:
        java.io.IOException - Error if a file operation fails
      • FileListDataItem

        public FileListDataItem​(FileSystemEvent event)
        Constructor used when a FileSystemEvent generates DataItems
        Parameters:
        event -
      • FileListDataItem

        public FileListDataItem​(java.lang.String name,
                                long size,
                                long modified,
                                int type)
        Constructor when the data is already known
        Parameters:
        name - Name for the DataItem
        size - Size of the DataItem
        modified - Last modified time of the DataItem
        type - The type of file this item is. Can be any of (FileListDataItem.DIR, FileListDataItem.FCWEBLINK, FileListDataItem.FILE, FileListDataItem.LINK, FileListDataItem.UNKNOWN)
    • Method Detail

      • toString

        public java.lang.String toString()
        Returns a String representation of this item.
        Overrides:
        toString in class java.lang.Object
        Returns:
        a String representation of this item.
      • isFile

        public boolean isFile()
        Returns true if this item is a file
        Specified by:
        isFile in interface unlimited.core.util.common.RemoteFileIfc
        Returns:
        true if this item is a file
      • isDirectory

        public boolean isDirectory()
        Returns true if this item is a directory
        Specified by:
        isDirectory in interface unlimited.core.util.common.RemoteFileIfc
        Returns:
        true if this item is a directory
      • isLink

        public boolean isLink()
        Returns true if this item is a symbolic link
        Specified by:
        isLink in interface unlimited.core.util.common.RemoteFileIfc
        Returns:
        true if this item is a symbolic link
      • isFCWebLink

        public boolean isFCWebLink()
        Returns true if this item is a symbolic link in FC Web
        Specified by:
        isFCWebLink in interface unlimited.core.util.common.RemoteFileIfc
        Returns:
        true if this item is a symbolic link in FC Web
      • getName

        public java.lang.String getName()
        Returns the filename for this item
        Specified by:
        getName in interface unlimited.core.util.common.RemoteFileIfc
        Returns:
        the filename for this item
      • setName

        public void setName​(java.lang.String name)
        Sets the data item name to the value specified
        Parameters:
        name - The new file name
      • getType

        public int getType()
        Returns the type of this item.
        Specified by:
        getType in interface unlimited.core.util.common.RemoteFileIfc
        Returns:
        the type of this item.
      • getSize

        public long getSize()
        Returns the size (in bytes) of this item.
        Specified by:
        getSize in interface unlimited.core.util.common.RemoteFileIfc
        Returns:
        the size (in bytes) of this item.
      • setModified

        public void setModified​(long modified)
        Set the last modified timestamp to the value specified
        Parameters:
        modified - New last modified value
      • getModified

        public long getModified()
        Returns the modified time (in millis since 1970).
        Specified by:
        getModified in interface unlimited.core.util.common.RemoteFileIfc
        Returns:
        the modified time (in millis since 1970).
      • getRealPath

        public java.lang.String getRealPath()
        Returns the real path for this FileListDataItem
        Specified by:
        getRealPath in interface unlimited.core.util.common.RemoteFileIfc
        Returns:
        String denoting the real path
      • getModifiedDate

        public java.util.Date getModifiedDate()
        Returns a Date object representing the modified time of this item
        Specified by:
        getModifiedDate in interface unlimited.core.util.common.RemoteFileIfc
        Returns:
        a Date object representing the modified time of this item
      • getModifiedFormatted

        public java.lang.String getModifiedFormatted()
        Returns a formated string representation of the modified date using the default locale. The format is MMM dd, yyyy HH:mm i.e. May 05, 2006 HH:mm
        Specified by:
        getModifiedFormatted in interface unlimited.core.util.common.RemoteFileIfc
        Returns:
        a formated string representation of the modified date.
      • setRealPath

        public void setRealPath​(java.lang.String realPath)
        Sets the real path of the item to the value specified
        Parameters:
        realPath - Value to set for the real path
      • setSize

        public void setSize​(long size)
        Sets the size of the item to the value provided
        Parameters:
        size - Size to be set
      • hashCode

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

        public boolean equals​(java.lang.Object obj)
        Specified by:
        equals in interface unlimited.core.util.common.RemoteFileIfc
        Overrides:
        equals in class java.lang.Object
      • getRelativePath

        public java.lang.String getRelativePath​(java.io.File relativeTo)
        Specified by:
        getRelativePath in interface unlimited.core.util.common.RemoteFileIfc
      • getRelativePath

        public java.lang.String getRelativePath​(java.nio.file.Path relativeTo)
        Specified by:
        getRelativePath in interface unlimited.core.util.common.RemoteFileIfc
      • clone

        public FileListDataItem clone()
                               throws java.lang.CloneNotSupportedException
        Overrides:
        clone in class java.lang.Object
        Throws:
        java.lang.CloneNotSupportedException
      • getChildCount

        public int getChildCount()
        Returns amount of children this item has
        Specified by:
        getChildCount in interface unlimited.core.util.common.RemoteFileIfc
        Returns:
        The child count
      • setChildCount

        public void setChildCount​(int count)
      • compareTo

        public int compareTo​(unlimited.core.util.common.RemoteFileIfc item)
        Specified by:
        compareTo in interface java.lang.Comparable<unlimited.core.util.common.RemoteFileIfc>
        Specified by:
        compareTo in interface unlimited.core.util.common.RemoteFileIfc
      • setType

        public void setType​(int type)
        Sets the type of the FileListDataItem to the value specified
        Parameters:
        type - Type to set