Package adams.core.io
Class SmbFileObject
- java.lang.Object
-
- adams.core.io.SmbFileObject
-
- All Implemented Interfaces:
FileObject,Serializable,Comparable<FileObject>
public class SmbFileObject extends Object implements FileObject
Wrapper for remote SMB files.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Booleanm_Directorywhether a directory.protected com.hierynomus.msfscc.fileinformation.FileIdBothDirectoryInformationm_Filethe actual file.protected Booleanm_Hiddenwhether the file is hidden.protected Datem_LastModifiedthe modified date.protected Longm_Lengththe length.protected Stringm_Namethe name to use (overrides m_File).protected Stringm_ParentDirthe parent dir.protected com.hierynomus.smbj.share.DiskSharem_Sharethe disk share.
-
Constructor Summary
Constructors Constructor Description SmbFileObject(com.hierynomus.smbj.share.DiskShare share, String parentDir, com.hierynomus.msfscc.fileinformation.FileIdBothDirectoryInformation file)Initializes the wrapper.SmbFileObject(com.hierynomus.smbj.share.DiskShare share, String parentDir, com.hierynomus.msfscc.fileinformation.FileIdBothDirectoryInformation file, String name)Initializes the wrapper.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(FileObject o)Returns whether this file object is the same as the provided one.booleanequals(Object obj)Checks whether this object is the same as the provided one.FilegetActualFile()Returns the actual target (if possible) in case of a link.FilegetFile()Returns the wrapped file.DategetLastModified()Returns the date when the file was last modified.longgetLength()Returns the size of the file.StringgetName()Returns the file name.FileObjectgetParent()Returns the parent, if available.StringgetParentDir()Returns the current parent directory.com.hierynomus.smbj.share.DiskSharegetShare()Returns the underlying disk share.booleanisDirectory()Returns whether the file represents a directory.booleanisHidden()Returns whether the file is hidden.booleanisLink()Returns whether the file represents a link.booleanisLocal()Returns whether the file is a local file.StringtoString()Returns the long name.
-
-
-
Field Detail
-
m_Share
protected com.hierynomus.smbj.share.DiskShare m_Share
the disk share.
-
m_ParentDir
protected String m_ParentDir
the parent dir.
-
m_File
protected com.hierynomus.msfscc.fileinformation.FileIdBothDirectoryInformation m_File
the actual file.
-
m_Name
protected String m_Name
the name to use (overrides m_File).
-
m_Length
protected Long m_Length
the length.
-
m_Directory
protected Boolean m_Directory
whether a directory.
-
m_LastModified
protected Date m_LastModified
the modified date.
-
m_Hidden
protected Boolean m_Hidden
whether the file is hidden.
-
-
Constructor Detail
-
SmbFileObject
public SmbFileObject(com.hierynomus.smbj.share.DiskShare share, String parentDir, com.hierynomus.msfscc.fileinformation.FileIdBothDirectoryInformation file)Initializes the wrapper.- Parameters:
share- the share to useparentDir- the parent dirfile- the file
-
SmbFileObject
public SmbFileObject(com.hierynomus.smbj.share.DiskShare share, String parentDir, com.hierynomus.msfscc.fileinformation.FileIdBothDirectoryInformation file, String name)Initializes the wrapper.- Parameters:
share- the share to useparentDir- the parent dirfile- the filename- the name to override the one from "file"
-
-
Method Detail
-
getParent
public FileObject getParent()
Returns the parent, if available.- Specified by:
getParentin interfaceFileObject- Returns:
- the parent or null if not available
-
getParentDir
public String getParentDir()
Returns the current parent directory.- Returns:
- the dir
-
getShare
public com.hierynomus.smbj.share.DiskShare getShare()
Returns the underlying disk share.- Returns:
- the share
-
getFile
public File getFile()
Returns the wrapped file.- Specified by:
getFilein interfaceFileObject- Returns:
- the file as UNC path
-
getActualFile
public File getActualFile()
Returns the actual target (if possible) in case of a link.- Specified by:
getActualFilein interfaceFileObject- Returns:
- the actual file as UNC path
-
getName
public String getName()
Returns the file name.- Specified by:
getNamein interfaceFileObject- Returns:
- the name
-
getLength
public long getLength()
Returns the size of the file.- Specified by:
getLengthin interfaceFileObject- Returns:
- the size
-
isDirectory
public boolean isDirectory()
Returns whether the file represents a directory.- Specified by:
isDirectoryin interfaceFileObject- Returns:
- true if directory
-
getLastModified
public Date getLastModified()
Returns the date when the file was last modified.- Specified by:
getLastModifiedin interfaceFileObject- Returns:
- date when last modified
-
isHidden
public boolean isHidden()
Returns whether the file is hidden.- Specified by:
isHiddenin interfaceFileObject- Returns:
- true if hidden
-
isLink
public boolean isLink()
Returns whether the file represents a link.- Specified by:
isLinkin interfaceFileObject- Returns:
- true if link
-
isLocal
public boolean isLocal()
Returns whether the file is a local file.- Specified by:
isLocalin interfaceFileObject- Returns:
- true if local
-
toString
public String toString()
Returns the long name.- Specified by:
toStringin interfaceFileObject- Overrides:
toStringin classObject- Returns:
- the long name, not UNC path!
-
compareTo
public int compareTo(FileObject o)
Returns whether this file object is the same as the provided one.- Specified by:
compareToin interfaceComparable<FileObject>- Parameters:
o- the file object to compare against- Returns:
- less than zero, equal to zero, greater than zero if this file object is less than, equal to, or greater than the other file object
-
equals
public boolean equals(Object obj)
Checks whether this object is the same as the provided one.- Overrides:
equalsin classObject- Parameters:
obj- the object to compare against- Returns:
- true if the same
- See Also:
compareTo(FileObject)
-
-