net.schmizz.sshj.xfer
Class FileSystemFile

java.lang.Object
  extended by net.schmizz.sshj.xfer.FileSystemFile
All Implemented Interfaces:
LocalDestFile, LocalSourceFile

public class FileSystemFile
extends Object
implements LocalSourceFile, LocalDestFile


Field Summary
protected  org.slf4j.Logger log
           
 
Constructor Summary
FileSystemFile(File file)
           
FileSystemFile(String path)
           
 
Method Summary
 boolean equals(Object other)
           
 FileSystemFile getChild(String name)
           
 Iterable<FileSystemFile> getChildren(LocalFileFilter filter)
           
 File getFile()
           
 InputStream getInputStream()
           
 long getLastAccessTime()
          Returns last access time for the underlying file.
 long getLastModifiedTime()
          Returns last access time for the underlying file.
 long getLength()
           
 String getName()
           
 OutputStream getOutputStream()
           
 int getPermissions()
          Returns the permissions for the underlying file
 FileSystemFile getTargetDirectory(String dirname)
          Allows caller to express intent that caller expects to write to directory with dirname.
 FileSystemFile getTargetFile(String filename)
          Allows caller to express intent that caller expects to write to file with filename.
 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.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

log

protected final org.slf4j.Logger log
Constructor Detail

FileSystemFile

public FileSystemFile(String path)

FileSystemFile

public FileSystemFile(File file)
Method Detail

getFile

public File getFile()

getName

public String getName()
Specified by:
getName in interface LocalSourceFile

isFile

public boolean isFile()
Specified by:
isFile in interface LocalSourceFile

isDirectory

public boolean isDirectory()
Specified by:
isDirectory in interface LocalSourceFile

getLength

public long getLength()
Specified by:
getLength in interface LocalSourceFile

getInputStream

public InputStream getInputStream()
                           throws IOException
Specified by:
getInputStream in interface LocalSourceFile
Throws:
IOException

getOutputStream

public OutputStream getOutputStream()
                             throws IOException
Specified by:
getOutputStream in interface LocalDestFile
Throws:
IOException

getChildren

public Iterable<FileSystemFile> getChildren(LocalFileFilter filter)
                                     throws IOException
Specified by:
getChildren in interface LocalSourceFile
Throws:
IOException

providesAtimeMtime

public boolean providesAtimeMtime()
Specified by:
providesAtimeMtime in interface LocalSourceFile

getLastAccessTime

public long getLastAccessTime()
                       throws IOException
Description copied from interface: LocalSourceFile
Returns last access time for the underlying file.

Specified by:
getLastAccessTime in interface LocalSourceFile
Returns:
time in seconds since Unix epoch
Throws:
IOException

getLastModifiedTime

public long getLastModifiedTime()
                         throws IOException
Description copied from interface: LocalSourceFile
Returns last access time for the underlying file.

Specified by:
getLastModifiedTime in interface LocalSourceFile
Returns:
time in seconds since Unix epoch
Throws:
IOException

getPermissions

public int getPermissions()
                   throws IOException
Description copied from interface: LocalSourceFile
Returns the permissions for the underlying file

Specified by:
getPermissions in interface LocalSourceFile
Returns:
permissions e.g. 0644
Throws:
IOException

setLastAccessedTime

public void setLastAccessedTime(long t)
                         throws IOException
Description copied from interface: LocalDestFile
Set the last access time for the underlying file.

Specified by:
setLastAccessedTime in interface LocalDestFile
Parameters:
t - time in seconds since Unix epoch
Throws:
IOException

setLastModifiedTime

public void setLastModifiedTime(long t)
                         throws IOException
Description copied from interface: LocalDestFile
Set the last modified time for the underlying file.

Specified by:
setLastModifiedTime in interface LocalDestFile
Parameters:
t - time in seconds since Unix epoch
Throws:
IOException

setPermissions

public void setPermissions(int perms)
                    throws IOException
Description copied from interface: LocalDestFile
Set the permissions for the underlying file.

Specified by:
setPermissions in interface LocalDestFile
Parameters:
perms - permissions e.g. 0644
Throws:
IOException

getChild

public FileSystemFile getChild(String name)
Specified by:
getChild in interface LocalDestFile
Returns:
A child file/directory of this directory with given name.

getTargetFile

public FileSystemFile getTargetFile(String filename)
                             throws IOException
Description copied from interface: LocalDestFile
Allows caller to express intent that caller expects to write to file with filename. 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 interface LocalDestFile
Throws:
IOException

getTargetDirectory

public FileSystemFile getTargetDirectory(String dirname)
                                  throws IOException
Description copied from interface: LocalDestFile
Allows caller to express intent that caller expects to write to directory with dirname. 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 interface LocalDestFile
Throws:
IOException

equals

public boolean equals(Object other)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009-2012. All Rights Reserved.