public class SFtp extends VirtualFileSystem.Abstract
VirtualFileSystem.Abstract| 限定符和类型 | 字段和说明 |
|---|---|
protected ch.ethz.ssh2.SFTPv3Client |
client0
sftp的channel
|
protected String |
coder |
protected ch.ethz.ssh2.Connection |
conn
sftp的session
|
protected String |
host |
protected String |
password |
protected int |
permissions |
protected int |
port |
protected String |
username |
dftPattern, id, LOG, root| 构造器和说明 |
|---|
SFtp() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
close() |
void |
configure(com.anysoft.util.Properties p) |
boolean |
deleteFile(String path)
删除指定路径的文件
|
boolean |
exist(String path)
指定的路径是否存在
|
void |
finishRead(String path,
InputStream in)
完成读取文件
|
void |
finishWrite(String path,
OutputStream out)
完成文件写入
|
protected ch.ethz.ssh2.SFTPv3Client |
getClient() |
protected void |
getFileInfo(ch.ethz.ssh2.SFTPv3FileAttributes attrs,
Map<String,Object> json) |
void |
getFileInfo(String path,
Map<String,Object> json)
获取指定的文件信息
|
long |
getFileSize(String path)
获取指定文件的大小
|
protected String |
getRealPath(String path) |
boolean |
isDir(String path)
指定的路径是否目录
|
List<String> |
listFiles(String path,
String pattern,
int offset,
int limit)
列出指定路径下的文件列表(支持分页查询)
|
void |
listFiles(String path,
String pattern,
Map<String,Object> json,
int offset,
int limit)
列出指定路径下文件信息列表(支持分页查询)
|
static void |
main(String[] args) |
boolean |
makeDirs(String path)
创建目录
|
InputStream |
readFile(String path)
读取文件
|
OutputStream |
writeFile(String path)
写入文件
|
protected ch.ethz.ssh2.SFTPv3Client client0
protected ch.ethz.ssh2.Connection conn
protected String host
protected int port
protected String username
protected int permissions
protected String password
protected String coder
public void configure(com.anysoft.util.Properties p)
configure 在接口中 com.anysoft.util.Configurableconfigure 在类中 VirtualFileSystem.Abstractprotected ch.ethz.ssh2.SFTPv3Client getClient()
protected void getFileInfo(ch.ethz.ssh2.SFTPv3FileAttributes attrs,
Map<String,Object> json)
public List<String> listFiles(String path, String pattern, int offset, int limit)
VirtualFileSystempath - 指定的路径pattern - 文件名匹配模板offset - 位置偏移limit - 每次查询的文件个数public void listFiles(String path, String pattern, Map<String,Object> json, int offset, int limit)
VirtualFileSystempath - 指定路径pattern - 文件名匹配模板json - 写出的JSON数据offset - 位置偏移limit - 每次查询的文件个数public boolean deleteFile(String path)
VirtualFileSystempath - 指定的文件路径public boolean exist(String path)
VirtualFileSystempath - 指定的路径public boolean isDir(String path)
VirtualFileSystempath - 指定的路径public long getFileSize(String path)
VirtualFileSystempath - 文件路径public void getFileInfo(String path, Map<String,Object> json)
VirtualFileSystempath - 指定文件的路径json - 文件信息输出public boolean makeDirs(String path)
VirtualFileSystempath - 目录的路径public InputStream readFile(String path)
VirtualFileSystempath - 文件的路径public void finishRead(String path, InputStream in)
VirtualFileSystempath - 文件的路径in - 文件的输入流public OutputStream writeFile(String path)
VirtualFileSystempath - 文件的路径public void finishWrite(String path, OutputStream out)
VirtualFileSystempath - 文件的路径out - 文件的输出流public static void main(String[] args) throws IOException
IOExceptionCopyright © 2017. All rights reserved.