public class ProxyFile extends Object implements AbstractFile
Modifier | Constructor and Description |
---|---|
protected |
ProxyFile(com.maverick.sftp.SftpFile file,
com.sshtools.sftp.SftpClient sftp,
ProxyFileFactory factory) |
protected |
ProxyFile(String name,
com.sshtools.sftp.SftpClient sftp,
ProxyFileFactory factory) |
Modifier and Type | Method and Description |
---|---|
void |
copyFrom(AbstractFile src)
Copy contain of source file to this file
|
boolean |
createFolder()
Create the folder in the server
|
boolean |
createNewFile()
Create the file in the server
|
boolean |
delete(boolean recursive)
Delete file or folder in the server
|
boolean |
exists()
Whether file or folder exist in the server
|
String |
getAbsolutePath()
Return the absolute path to the file
|
SftpFileAttributes |
getAttributes()
This method returns
SftpFileAttributes of the file |
String |
getCanonicalPath()
This method return Canonical path of the file
|
List<AbstractFile> |
getChildren()
This method return the list of Abstractfile this ProxyFile has.
|
AbstractFileFactory<? extends AbstractFile> |
getFileFactory() |
InputStream |
getInputStream() |
String |
getName() |
OutputStream |
getOutputStream() |
OutputStream |
getOutputStream(boolean append) |
boolean |
isDirectory() |
boolean |
isFile() |
boolean |
isHidden() |
boolean |
isReadable() |
boolean |
isWritable() |
long |
lastModified()
get the last modified time of the file.
|
long |
length()
get the size of the file
|
void |
moveTo(AbstractFile destination) |
AbstractFileRandomAccess |
openFile(boolean writeAccess)
This method is not supported
|
void |
refresh() |
AbstractFile |
resolveFile(String path) |
void |
setAttributes(SftpFileAttributes newAtt) |
boolean |
supportsRandomAccess()
random access is not supported
|
void |
truncate() |
protected ProxyFile(String name, com.sshtools.sftp.SftpClient sftp, ProxyFileFactory factory) throws com.maverick.sftp.SftpStatusException, SshException
name
- : file or folder namesftp
- : SftpClient instance representing the remore file systemSshException
com.maverick.sftp.SftpStatusException
protected ProxyFile(com.maverick.sftp.SftpFile file, com.sshtools.sftp.SftpClient sftp, ProxyFileFactory factory) throws com.maverick.sftp.SftpStatusException, SshException
com.maverick.sftp.SftpStatusException
SshException
public void copyFrom(AbstractFile src) throws IOException, PermissionDeniedException
copyFrom
in interface AbstractFile
src
- : source in which data to be copied. It should a file.:
- system throws IOException
if the source is not a
file or unable to connect to source file.IOException
PermissionDeniedException
public boolean createFolder() throws PermissionDeniedException, IOException
createFolder
in interface AbstractFile
PermissionDeniedException
IOException
public boolean createNewFile() throws PermissionDeniedException, IOException
createNewFile
in interface AbstractFile
PermissionDeniedException
IOException
public boolean delete(boolean recursive) throws IOException, PermissionDeniedException
delete
in interface AbstractFile
recrusive
- : if the file is folder delete contain of folder recursivelythrows
- IOException
IOException
PermissionDeniedException
public boolean exists() throws IOException
exists
in interface AbstractFile
throws
- IOException
if unable to connect to the serverIOException
public String getAbsolutePath() throws IOException, PermissionDeniedException
getAbsolutePath
in interface AbstractFile
IOException
PermissionDeniedException
public SftpFileAttributes getAttributes() throws FileNotFoundException, IOException, PermissionDeniedException
SftpFileAttributes
of the filegetAttributes
in interface AbstractFile
SftpFileAttributes
FileNotFoundException
IOException
PermissionDeniedException
public String getCanonicalPath() throws IOException, PermissionDeniedException
getCanonicalPath
in interface AbstractFile
IOException
PermissionDeniedException
public List<AbstractFile> getChildren() throws IOException, PermissionDeniedException
getChildren
in interface AbstractFile
IOException
PermissionDeniedException
public AbstractFileFactory<? extends AbstractFile> getFileFactory()
getFileFactory
in interface AbstractFile
public InputStream getInputStream() throws IOException
getInputStream
in interface AbstractFile
IOException
public String getName()
getName
in interface AbstractFile
public OutputStream getOutputStream() throws IOException
getOutputStream
in interface AbstractFile
IOException
public OutputStream getOutputStream(boolean append) throws IOException
getOutputStream
in interface AbstractFile
IOException
public boolean isDirectory() throws IOException
isDirectory
in interface AbstractFile
IOException
public boolean isFile() throws IOException
isFile
in interface AbstractFile
IOException
public boolean isHidden() throws IOException
isHidden
in interface AbstractFile
IOException
public boolean isReadable() throws IOException
isReadable
in interface AbstractFile
IOException
public boolean isWritable() throws IOException
isWritable
in interface AbstractFile
IOException
public long lastModified() throws IOException
lastModified
in interface AbstractFile
IOException
public long length() throws IOException
length
in interface AbstractFile
:
- IOException
if unable to access remote fileIOException
public void moveTo(AbstractFile destination) throws IOException, PermissionDeniedException
moveTo
in interface AbstractFile
IOException
PermissionDeniedException
public AbstractFileRandomAccess openFile(boolean writeAccess) throws IOException
openFile
in interface AbstractFile
IOException
public void refresh()
refresh
in interface AbstractFile
public AbstractFile resolveFile(String path) throws IOException, PermissionDeniedException
resolveFile
in interface AbstractFile
IOException
PermissionDeniedException
public void setAttributes(SftpFileAttributes newAtt) throws IOException
setAttributes
in interface AbstractFile
IOException
public boolean supportsRandomAccess()
supportsRandomAccess
in interface AbstractFile
public void truncate() throws PermissionDeniedException, IOException
truncate
in interface AbstractFile
PermissionDeniedException
IOException
Copyright © 2024. All rights reserved.