com.mindtree.techworks.insight.download.sftpbrowse
Class SFTPFileFile

java.lang.Object
  extended by java.io.File
      extended by com.mindtree.techworks.insight.download.sftpbrowse.SFTPFileFile
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<java.io.File>

public class SFTPFileFile
extends java.io.File

This class is a wrapper for SFTPFile. This class is to be used by JFileChooserwhich requires an instance of File to it.

Most operations on the file wrapped by this class are not allowed . SFTPFile is meant to contain information about files on a remote server, and SFTPFileFile is also meant for the same. It merely provides a File like interface to SFTPFile.

For any operations on the file, use the information about the file from an instance of this class and use SftpClient or any wrapper around it. You might use any other SFTPClient also.

The getHostURL, getPort and getPasswordAuthentication methods return the host and authentication information to connect to the host.

Version:
$Revision: 27 $ $Date: 2007-12-16 04:58:03 -0700 (Sun, 16 Dec 2007) $
Author:
Bindul Bhowmik
See Also:
SftpFile, File, Serialized Form

Field Summary
 
Fields inherited from class java.io.File
pathSeparator, pathSeparatorChar, separator, separatorChar
 
Constructor Summary
SFTPFileFile(com.sshtools.j2ssh.sftp.SftpFile sftpFile, javax.swing.filechooser.FileSystemView fileSystemView)
          Constructs a new FTPFileFile object.
 
Method Summary
 boolean canRead()
          Always returns true.
 boolean canWrite()
          Always returns false.
 int compareTo(java.io.File pathname)
           
 int compareTo(java.lang.Object o)
           
 boolean createNewFile()
          Operation not supported.
 boolean delete()
          Operation not supported, always returns false
 void deleteOnExit()
          Operation not supported.
 boolean equals(java.lang.Object obj)
           
 boolean exists()
          Returns true always.
 java.io.File getAbsoluteFile()
          Returns the same instance!
 java.lang.String getAbsolutePath()
          Returns the path!
 java.io.File getCanonicalFile()
          Returns the instance as the canonical file
 java.lang.String getCanonicalPath()
          Always returns the unix style path from the root.
 java.lang.String getHost()
           
 java.lang.String getName()
          Returns the name of the file
 java.lang.String getParent()
          Returns the path of the parent, if a file system view is present, or null.
 java.io.File getParentFile()
          Returns the parent directory, if a file system view is present, or null.
 java.net.PasswordAuthentication getPasswordAuthentication()
           
 java.lang.String getPath()
          Returns the path in the unix style.
 int getPort()
           
 com.sshtools.j2ssh.sftp.SftpFile getSftpFile()
           
 boolean isAbsolute()
           
 boolean isDirectory()
           
 boolean isFile()
           
 boolean isHidden()
          Returns false.
 long lastModified()
           
 long length()
          Returns the size of the FTP file instance
 java.lang.String[] list()
          Operation is not supported.
 java.lang.String[] list(java.io.FilenameFilter filter)
          Operation is not supported.
 java.io.File[] listFiles()
          Operation is not supported.
 java.io.File[] listFiles(java.io.FileFilter filter)
          Operation is not supported.
 java.io.File[] listFiles(java.io.FilenameFilter filter)
          Operation is not supported.
 boolean mkdir()
          The operation is not supported, always returns false
 boolean mkdirs()
          The operation is not supported, always returns false
 boolean renameTo(java.io.File dest)
          The operation is not supported, always returns false
 boolean setLastModified(long time)
          The operation is not supported, always returns false
 boolean setReadOnly()
          The operation is not supported, always returns false
 java.net.URI toURI()
           
 java.net.URL toURL()
           
 
Methods inherited from class java.io.File
canExecute, createTempFile, createTempFile, getFreeSpace, getTotalSpace, getUsableSpace, hashCode, listRoots, setExecutable, setExecutable, setReadable, setReadable, setWritable, setWritable, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SFTPFileFile

public SFTPFileFile(com.sshtools.j2ssh.sftp.SftpFile sftpFile,
                    javax.swing.filechooser.FileSystemView fileSystemView)
Constructs a new FTPFileFile object.

Parameters:
sftpFile - The FTPFile instance to wrap
fileSystemView - The file system view which created this instance.
Method Detail

getPasswordAuthentication

public java.net.PasswordAuthentication getPasswordAuthentication()
Returns:
Returns the passwordAuthentication.

getHost

public java.lang.String getHost()
Returns:
Returns the hostURL.

getPort

public int getPort()
Returns:
Returns the port connected to

getSftpFile

public com.sshtools.j2ssh.sftp.SftpFile getSftpFile()
Returns:
Returns the sftpFile.

isAbsolute

public boolean isAbsolute()
Overrides:
isAbsolute in class java.io.File
See Also:
File.isAbsolute()

isDirectory

public boolean isDirectory()
Overrides:
isDirectory in class java.io.File
See Also:
File.isDirectory()

isFile

public boolean isFile()
Overrides:
isFile in class java.io.File
See Also:
File.isFile()

lastModified

public long lastModified()
Overrides:
lastModified in class java.io.File
See Also:
File.lastModified()

canRead

public boolean canRead()
Always returns true. Read access is always allowed.

Overrides:
canRead in class java.io.File
See Also:
File.canRead()

canWrite

public boolean canWrite()
Always returns false. For more information, see note above.

Overrides:
canWrite in class java.io.File
See Also:
File.canWrite()

compareTo

public int compareTo(java.io.File pathname)
Specified by:
compareTo in interface java.lang.Comparable<java.io.File>
Overrides:
compareTo in class java.io.File
See Also:
File.compareTo(java.io.File)

compareTo

public int compareTo(java.lang.Object o)
Overrides:
compareTo in class java.io.File
See Also:
Comparable.compareTo(java.lang.Object)

createNewFile

public boolean createNewFile()
                      throws java.io.IOException
Operation not supported.

Overrides:
createNewFile in class java.io.File
Throws:
java.io.IOException - Since this operation is not supported.
See Also:
File.createNewFile()

delete

public boolean delete()
Operation not supported, always returns false

Overrides:
delete in class java.io.File
Throws:
java.lang.UnsupportedOperationException - Since this operation is not supported.
See Also:
File.delete()

deleteOnExit

public void deleteOnExit()
Operation not supported. Nothing is returned.

Overrides:
deleteOnExit in class java.io.File
See Also:
File.deleteOnExit()

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.io.File
See Also:
Object.equals(java.lang.Object)

exists

public boolean exists()
Returns true always. Any file for which an FTPFile instance can be got is assumed to exist.

Overrides:
exists in class java.io.File
See Also:
File.exists()

getAbsoluteFile

public java.io.File getAbsoluteFile()
Returns the same instance!

Overrides:
getAbsoluteFile in class java.io.File
See Also:
File.getAbsoluteFile()

getAbsolutePath

public java.lang.String getAbsolutePath()
Returns the path!

Overrides:
getAbsolutePath in class java.io.File
See Also:
File.getAbsolutePath()

getCanonicalFile

public java.io.File getCanonicalFile()
                              throws java.io.IOException
Returns the instance as the canonical file

Overrides:
getCanonicalFile in class java.io.File
Throws:
java.io.IOException
See Also:
File.getCanonicalFile()

getCanonicalPath

public java.lang.String getCanonicalPath()
                                  throws java.io.IOException
Always returns the unix style path from the root.

Overrides:
getCanonicalPath in class java.io.File
Throws:
java.io.IOException
See Also:
File.getCanonicalPath()

getName

public java.lang.String getName()
Returns the name of the file

Overrides:
getName in class java.io.File
See Also:
File.getName()

getParent

public java.lang.String getParent()
Returns the path of the parent, if a file system view is present, or null.

Overrides:
getParent in class java.io.File
See Also:
File.getParent()

getParentFile

public java.io.File getParentFile()
Returns the parent directory, if a file system view is present, or null.

Overrides:
getParentFile in class java.io.File
See Also:
File.getParentFile()

getPath

public java.lang.String getPath()
Returns the path in the unix style.

Overrides:
getPath in class java.io.File
See Also:
File.getPath()

isHidden

public boolean isHidden()
Returns false. No files are hidden!

Overrides:
isHidden in class java.io.File
See Also:
File.isHidden()

length

public long length()
Returns the size of the FTP file instance

Overrides:
length in class java.io.File
See Also:
File.length()

list

public java.lang.String[] list()
Operation is not supported. Use the SFTPRemoteFileSystemViewfor this.

Overrides:
list in class java.io.File
Returns:
An empty String array
See Also:
File.list()

list

public java.lang.String[] list(java.io.FilenameFilter filter)
Operation is not supported. Use the SFTPRemoteFileSystemViewfor this.

Overrides:
list in class java.io.File
Returns:
An empty String array
See Also:
File.list(java.io.FilenameFilter)

listFiles

public java.io.File[] listFiles()
Operation is not supported. Use the SFTPRemoteFileSystemViewfor this.

Overrides:
listFiles in class java.io.File
Returns:
An empty File array
See Also:
File.listFiles()

listFiles

public java.io.File[] listFiles(java.io.FileFilter filter)
Operation is not supported. Use the SFTPRemoteFileSystemViewfor this.

Overrides:
listFiles in class java.io.File
Returns:
An empty File array
See Also:
File.listFiles(java.io.FileFilter)

listFiles

public java.io.File[] listFiles(java.io.FilenameFilter filter)
Operation is not supported. Use the SFTPRemoteFileSystemViewfor this.

Overrides:
listFiles in class java.io.File
Returns:
An empty File array
See Also:
File.listFiles(java.io.FilenameFilter)

mkdir

public boolean mkdir()
The operation is not supported, always returns false

Overrides:
mkdir in class java.io.File
See Also:
File.mkdir()

mkdirs

public boolean mkdirs()
The operation is not supported, always returns false

Overrides:
mkdirs in class java.io.File
See Also:
File.mkdirs()

renameTo

public boolean renameTo(java.io.File dest)
The operation is not supported, always returns false

Overrides:
renameTo in class java.io.File
See Also:
File.renameTo(java.io.File)

setLastModified

public boolean setLastModified(long time)
The operation is not supported, always returns false

Overrides:
setLastModified in class java.io.File
See Also:
File.setLastModified(long)

setReadOnly

public boolean setReadOnly()
The operation is not supported, always returns false

Overrides:
setReadOnly in class java.io.File
See Also:
File.setReadOnly()

toURI

public java.net.URI toURI()
Overrides:
toURI in class java.io.File
See Also:
File.toURI()

toURL

public java.net.URL toURL()
                   throws java.net.MalformedURLException
Overrides:
toURL in class java.io.File
Throws:
java.net.MalformedURLException
See Also:
File.toURL()


Copyright © 2003-2008 MindTree Consulting Ltd.. All Rights Reserved.