Package net.schmizz.sshj.xfer
Class FileSystemFile
- java.lang.Object
-
- net.schmizz.sshj.xfer.FileSystemFile
-
- All Implemented Interfaces:
LocalDestFile,LocalSourceFile
public class FileSystemFile extends java.lang.Object implements LocalSourceFile, LocalDestFile
-
-
Field Summary
Fields Modifier and Type Field Description protected org.slf4j.Loggerlog
-
Constructor Summary
Constructors Constructor Description FileSystemFile(java.io.File file)FileSystemFile(java.lang.String path)
-
Method Summary
Modifier and Type Method Description booleanequals(java.lang.Object other)FileSystemFilegetChild(java.lang.String name)java.lang.Iterable<FileSystemFile>getChildren(LocalFileFilter filter)java.io.FilegetFile()java.io.InputStreamgetInputStream()longgetLastAccessTime()Returns last access time for the underlying file.longgetLastModifiedTime()Returns last access time for the underlying file.longgetLength()java.lang.StringgetName()java.io.OutputStreamgetOutputStream()intgetPermissions()Returns the permissions for the underlying fileFileSystemFilegetTargetDirectory(java.lang.String dirname)Allows caller to express intent that caller expects to write to directory withdirname.FileSystemFilegetTargetFile(java.lang.String filename)Allows caller to express intent that caller expects to write to file withfilename.inthashCode()booleanisDirectory()booleanisFile()booleanprovidesAtimeMtime()voidsetLastAccessedTime(long t)Set the last access time for the underlying file.voidsetLastModifiedTime(long t)Set the last modified time for the underlying file.voidsetPermissions(int perms)Set the permissions for the underlying file.java.lang.StringtoString()
-
-
-
Method Detail
-
getFile
public java.io.File getFile()
-
getName
public java.lang.String getName()
- Specified by:
getNamein interfaceLocalSourceFile
-
isFile
public boolean isFile()
- Specified by:
isFilein interfaceLocalSourceFile
-
isDirectory
public boolean isDirectory()
- Specified by:
isDirectoryin interfaceLocalSourceFile
-
getLength
public long getLength()
- Specified by:
getLengthin interfaceLocalSourceFile
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOException- Specified by:
getInputStreamin interfaceLocalSourceFile- Throws:
java.io.IOException
-
getOutputStream
public java.io.OutputStream getOutputStream() throws java.io.IOException- Specified by:
getOutputStreamin interfaceLocalDestFile- Throws:
java.io.IOException
-
getChildren
public java.lang.Iterable<FileSystemFile> getChildren(LocalFileFilter filter) throws java.io.IOException
- Specified by:
getChildrenin interfaceLocalSourceFile- Throws:
java.io.IOException
-
providesAtimeMtime
public boolean providesAtimeMtime()
- Specified by:
providesAtimeMtimein interfaceLocalSourceFile
-
getLastAccessTime
public long getLastAccessTime() throws java.io.IOExceptionDescription copied from interface:LocalSourceFileReturns last access time for the underlying file.- Specified by:
getLastAccessTimein interfaceLocalSourceFile- Returns:
- time in seconds since Unix epoch
- Throws:
java.io.IOException
-
getLastModifiedTime
public long getLastModifiedTime() throws java.io.IOExceptionDescription copied from interface:LocalSourceFileReturns last access time for the underlying file.- Specified by:
getLastModifiedTimein interfaceLocalSourceFile- Returns:
- time in seconds since Unix epoch
- Throws:
java.io.IOException
-
getPermissions
public int getPermissions() throws java.io.IOExceptionDescription copied from interface:LocalSourceFileReturns the permissions for the underlying file- Specified by:
getPermissionsin interfaceLocalSourceFile- Returns:
- permissions e.g. 0644
- Throws:
java.io.IOException
-
setLastAccessedTime
public void setLastAccessedTime(long t) throws java.io.IOExceptionDescription copied from interface:LocalDestFileSet the last access time for the underlying file.- Specified by:
setLastAccessedTimein interfaceLocalDestFile- Parameters:
t- time in seconds since Unix epoch- Throws:
java.io.IOException
-
setLastModifiedTime
public void setLastModifiedTime(long t) throws java.io.IOExceptionDescription copied from interface:LocalDestFileSet the last modified time for the underlying file.- Specified by:
setLastModifiedTimein interfaceLocalDestFile- Parameters:
t- time in seconds since Unix epoch- Throws:
java.io.IOException
-
setPermissions
public void setPermissions(int perms) throws java.io.IOExceptionDescription copied from interface:LocalDestFileSet the permissions for the underlying file.- Specified by:
setPermissionsin interfaceLocalDestFile- Parameters:
perms- permissions e.g. 0644- Throws:
java.io.IOException
-
getChild
public FileSystemFile getChild(java.lang.String name)
- Specified by:
getChildin interfaceLocalDestFile- Returns:
- A child file/directory of this directory with given
name.
-
getTargetFile
public FileSystemFile getTargetFile(java.lang.String filename) throws java.io.IOException
Description copied from interface:LocalDestFileAllows caller to express intent that caller expects to write to file withfilename. Based on this information, an implementation may return an alternate file to write to, which should be respected by the caller.- Specified by:
getTargetFilein interfaceLocalDestFile- Throws:
java.io.IOException
-
getTargetDirectory
public FileSystemFile getTargetDirectory(java.lang.String dirname) throws java.io.IOException
Description copied from interface:LocalDestFileAllows caller to express intent that caller expects to write to directory withdirname. Based on this information, an implementation may return an alternate directory to write to, which should be respected by the caller.- Specified by:
getTargetDirectoryin interfaceLocalDestFile- Throws:
java.io.IOException
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-