Package unlimited.fc.client.api
Class FileListDataItem
- java.lang.Object
-
- unlimited.fc.client.api.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.RemoteFileIfcThis 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 intDIRType returned by getType() if this item is a directory.static FileListDataItemEMPTYstatic intFCWEBLINKType returned by getType() if this item is a link.static intFILEType returned by getType() if this item is a file.static intLINKType returned by getType() if this item is a link.static intUNKNOWNType 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 knownFileListDataItem(java.lang.String name, long size, long modified, int type)Constructor when the data is already knownFileListDataItem(java.nio.file.Path file)Constructor when a Java.NIO Path object is knownFileListDataItem(FileSystemEvent event)Constructor used when a FileSystemEvent generates DataItems
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FileListDataItemclone()intcompareTo(unlimited.core.util.common.RemoteFileIfc item)booleanequals(java.lang.Object obj)intgetChildCount()Returns amount of children this item haslonggetModified()Returns the modified time (in millis since 1970).java.util.DategetModifiedDate()Returns a Date object representing the modified time of this itemjava.lang.StringgetModifiedFormatted()Returns a formated string representation of the modified date using the default locale.java.lang.StringgetName()Returns the filename for this itemjava.lang.StringgetRealPath()Returns the real path for this FileListDataItemjava.lang.StringgetRelativePath(java.io.File relativeTo)java.lang.StringgetRelativePath(java.nio.file.Path relativeTo)longgetSize()Returns the size (in bytes) of this item.intgetType()Returns the type of this item.inthashCode()booleanisDirectory()Returns true if this item is a directorybooleanisFCWebLink()Returns true if this item is a symbolic link in FC WebbooleanisFile()Returns true if this item is a filebooleanisLink()Returns true if this item is a symbolic linkvoidsetChildCount(int count)voidsetModified(long modified)Set the last modified timestamp to the value specifiedvoidsetName(java.lang.String name)Sets the data item name to the value specifiedvoidsetRealPath(java.lang.String realPath)Sets the real path of the item to the value specifiedvoidsetSize(long size)Sets the size of the item to the value providedvoidsetType(int type)Sets the type of the FileListDataItem to the value specifiedjava.lang.StringtoString()Returns a String representation of this item.
-
-
-
Field Detail
-
EMPTY
public static final FileListDataItem EMPTY
-
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.IOExceptionConstructor 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 DataItemsize- Size of the DataItemmodified- Last modified time of the DataItemtype- 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:
toStringin classjava.lang.Object- Returns:
- a String representation of this item.
-
isFile
public boolean isFile()
Returns true if this item is a file- Specified by:
isFilein interfaceunlimited.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:
isDirectoryin interfaceunlimited.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:
isLinkin interfaceunlimited.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:
isFCWebLinkin interfaceunlimited.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:
getNamein interfaceunlimited.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:
getTypein interfaceunlimited.core.util.common.RemoteFileIfc- Returns:
- the type of this item.
-
getSize
public long getSize()
Returns the size (in bytes) of this item.- Specified by:
getSizein interfaceunlimited.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:
getModifiedin interfaceunlimited.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:
getRealPathin interfaceunlimited.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:
getModifiedDatein interfaceunlimited.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:
getModifiedFormattedin interfaceunlimited.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:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Specified by:
equalsin interfaceunlimited.core.util.common.RemoteFileIfc- Overrides:
equalsin classjava.lang.Object
-
getRelativePath
public java.lang.String getRelativePath(java.io.File relativeTo)
- Specified by:
getRelativePathin interfaceunlimited.core.util.common.RemoteFileIfc
-
getRelativePath
public java.lang.String getRelativePath(java.nio.file.Path relativeTo)
- Specified by:
getRelativePathin interfaceunlimited.core.util.common.RemoteFileIfc
-
clone
public FileListDataItem clone() throws java.lang.CloneNotSupportedException
- Overrides:
clonein classjava.lang.Object- Throws:
java.lang.CloneNotSupportedException
-
getChildCount
public int getChildCount()
Returns amount of children this item has- Specified by:
getChildCountin interfaceunlimited.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:
compareToin interfacejava.lang.Comparable<unlimited.core.util.common.RemoteFileIfc>- Specified by:
compareToin interfaceunlimited.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
-
-