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.Logger
log
-
Constructor Summary
Constructors Constructor Description FileSystemFile(java.io.File file)
FileSystemFile(java.lang.String path)
-
Method Summary
Modifier and Type Method Description boolean
equals(java.lang.Object other)
FileSystemFile
getChild(java.lang.String name)
java.lang.Iterable<FileSystemFile>
getChildren(LocalFileFilter filter)
java.io.File
getFile()
java.io.InputStream
getInputStream()
long
getLastAccessTime()
Returns last access time for the underlying file.long
getLastModifiedTime()
Returns last access time for the underlying file.long
getLength()
java.lang.String
getName()
java.io.OutputStream
getOutputStream()
java.io.OutputStream
getOutputStream(boolean append)
int
getPermissions()
Returns the permissions for the underlying fileFileSystemFile
getTargetDirectory(java.lang.String dirname)
Allows caller to express intent that caller expects to write to directory withdirname
.FileSystemFile
getTargetFile(java.lang.String filename)
Allows caller to express intent that caller expects to write to file withfilename
.int
hashCode()
boolean
isDirectory()
boolean
isFile()
boolean
providesAtimeMtime()
void
setLastAccessedTime(long t)
Set the last access time for the underlying file.void
setLastModifiedTime(long t)
Set the last modified time for the underlying file.void
setPermissions(int perms)
Set the permissions for the underlying file.java.lang.String
toString()
-
-
-
Method Detail
-
getFile
public java.io.File getFile()
-
getName
public java.lang.String getName()
- Specified by:
getName
in interfaceLocalSourceFile
-
isFile
public boolean isFile()
- Specified by:
isFile
in interfaceLocalSourceFile
-
isDirectory
public boolean isDirectory()
- Specified by:
isDirectory
in interfaceLocalSourceFile
-
getLength
public long getLength()
- Specified by:
getLength
in interfaceLocalDestFile
- Specified by:
getLength
in interfaceLocalSourceFile
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOException
- Specified by:
getInputStream
in interfaceLocalSourceFile
- Throws:
java.io.IOException
-
getOutputStream
public java.io.OutputStream getOutputStream() throws java.io.IOException
- Specified by:
getOutputStream
in interfaceLocalDestFile
- Throws:
java.io.IOException
-
getOutputStream
public java.io.OutputStream getOutputStream(boolean append) throws java.io.IOException
- Specified by:
getOutputStream
in interfaceLocalDestFile
- Throws:
java.io.IOException
-
getChildren
public java.lang.Iterable<FileSystemFile> getChildren(LocalFileFilter filter) throws java.io.IOException
- Specified by:
getChildren
in interfaceLocalSourceFile
- Throws:
java.io.IOException
-
providesAtimeMtime
public boolean providesAtimeMtime()
- Specified by:
providesAtimeMtime
in interfaceLocalSourceFile
-
getLastAccessTime
public long getLastAccessTime() throws java.io.IOException
Description copied from interface:LocalSourceFile
Returns last access time for the underlying file.- Specified by:
getLastAccessTime
in interfaceLocalSourceFile
- Returns:
- time in seconds since Unix epoch
- Throws:
java.io.IOException
-
getLastModifiedTime
public long getLastModifiedTime() throws java.io.IOException
Description copied from interface:LocalSourceFile
Returns last access time for the underlying file.- Specified by:
getLastModifiedTime
in interfaceLocalSourceFile
- Returns:
- time in seconds since Unix epoch
- Throws:
java.io.IOException
-
getPermissions
public int getPermissions() throws java.io.IOException
Description copied from interface:LocalSourceFile
Returns the permissions for the underlying file- Specified by:
getPermissions
in interfaceLocalSourceFile
- Returns:
- permissions e.g. 0644
- Throws:
java.io.IOException
-
setLastAccessedTime
public void setLastAccessedTime(long t) throws java.io.IOException
Description copied from interface:LocalDestFile
Set the last access time for the underlying file.- Specified by:
setLastAccessedTime
in interfaceLocalDestFile
- Parameters:
t
- time in seconds since Unix epoch- Throws:
java.io.IOException
-
setLastModifiedTime
public void setLastModifiedTime(long t) throws java.io.IOException
Description copied from interface:LocalDestFile
Set the last modified time for the underlying file.- Specified by:
setLastModifiedTime
in interfaceLocalDestFile
- Parameters:
t
- time in seconds since Unix epoch- Throws:
java.io.IOException
-
setPermissions
public void setPermissions(int perms) throws java.io.IOException
Description copied from interface:LocalDestFile
Set the permissions for the underlying file.- Specified by:
setPermissions
in interfaceLocalDestFile
- Parameters:
perms
- permissions e.g. 0644- Throws:
java.io.IOException
-
getChild
public FileSystemFile getChild(java.lang.String name)
- Specified by:
getChild
in 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:LocalDestFile
Allows 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:
getTargetFile
in interfaceLocalDestFile
- Throws:
java.io.IOException
-
getTargetDirectory
public FileSystemFile getTargetDirectory(java.lang.String dirname) throws java.io.IOException
Description copied from interface:LocalDestFile
Allows 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:
getTargetDirectory
in interfaceLocalDestFile
- Throws:
java.io.IOException
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-