欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

java代碼連接sftp,java代碼連接不上oracle

java實(shí)現(xiàn)sftp功能,linux上可以,solaris異常

狀態(tài)集合I的a弧轉(zhuǎn)換,表示為move(I,a)定義為狀態(tài)集合J,其中J是所有那些可從I的某一狀態(tài)經(jīng)過一條a弧而到達(dá)的狀態(tài)的全體。

創(chuàng)新互聯(lián)建站于2013年成立,是專業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項(xiàng)目網(wǎng)站設(shè)計(jì)、成都網(wǎng)站建設(shè)網(wǎng)站策劃,項(xiàng)目實(shí)施與項(xiàng)目整合能力。我們以讓每一個(gè)夢想脫穎而出為使命,1280元西秀做網(wǎng)站,已為上家服務(wù),為西秀各地企業(yè)和個(gè)人服務(wù),聯(lián)系電話:028-86922220

定義Ia = ε-closure(move(I,a))

java連接Sftp服務(wù)器后,使用第三方j(luò)ar com.jcraft.jsch.ChannelSftp;用get()方法獲取的InputStream流為空

java連接Sftp服務(wù)器后,使用第三方j(luò)ar com.jcraft.jsch.ChannelSftp;用get()方法獲取的InputStream流為空,檢查下第3方初始化這些寫對沒有,或者就是沒得到流,打印看看,解決問題。

sftp免密用java怎么調(diào)用

import java.io.File;

import java.io.FileInputStream;

import java.io.FileNotFoundException;

import java.io.FileOutputStream;

import java.io.IOException;

import java.util.ArrayList;

import java.util.Iterator;

import java.util.List;

import java.util.Properties;

import java.util.Vector;

import org.apache.commons.lang.ArrayUtils;

import com.huawei.bme.commons.om.log.DebugLog;

import com.huawei.bme.commons.om.log.LogFactory;

import com.huawei.icity.commons.constants.KeyConstant;

import com.huawei.icity.commons.constants.NumberConstant;

import com.huawei.icity.commons.exception.SPMException;

import com.huawei.icity.commons.log.IcityLogFactory;

import com.huawei.icity.commons.log.IcityRuntimeLog;

import com.huawei.icity.commons.sysconfig.StaticInitData;

import com.huawei.icity.commons.utils.StringTools;

import com.huawei.icity.omp.common.util.CommonTools;

import com.huawei.icity.omp.interfaces.hint.constant.TimetaskConstants;

import com.huawei.mdmc.bfm.cms.assist.common.domain.SingleTableModel;

import com.jcraft.jsch.Channel;

import com.jcraft.jsch.ChannelSftp;

import com.jcraft.jsch.ChannelS;

import com.jcraft.jsch.JSch;

import com.jcraft.jsch.JSchException;

import com.jcraft.jsch.Session;

import com.jcraft.jsch.SftpException;

/**

* SFTP公共處理類 〈提供SFTP文件上傳,下載,獲取指定目錄 下文件名集合, 獲取指定目錄 下文件集合等方法

*

* @author mKF75022

* @version iCity Manager V100R002 2012-7-3

* @since iCity Manager V100R002C01

*/

public class SFTPTool

{

/**

* 調(diào)測日志記錄器。

*/

private static final DebugLog DEBUGGER = LogFactory.getDebugLog(SFTPTool.class);

/**

* 運(yùn)行日志記錄器。

*/

private static final IcityRuntimeLog RUNTIMELOGGER = IcityLogFactory

.getRuntimeLog(SFTPTool.class);

/**

* Sftp客戶端對象

*/

private ChannelSftp sftp = null;

/**

* SFTP IP地址

*/

private String ip;

/**

* SFTP 端口

*/

private String port;

/**

* SFTP 用戶名

*/

private String userName;

/**

* SFTP 密碼

*/

private String password;

/**

* SFTP上傳模式:BINARY

*/

// private static final int BINARY_FILE_TYPE = 2;

/**

*

* 獲取實(shí)例

*

* @return SFTPTool newinstance實(shí)例

*

*/

public static SFTPTool getNewInstance()

{

return new SFTPTool();

}

/**

* 初始化連接參數(shù)

*

* @param sftpIP

* IP

* @param sftpPort

* 端口

* @param sftpUsername

* 用戶名

* @param sftpPassword

* 密碼

*/

public void init(String sftpIP, String sftpPort, String sftpUsername, String sftpPassword)

{

// 獲取SFTP連接信息

this.ip = sftpIP;

this.port = sftpPort;

this.userName = sftpUsername;

this.password = sftpPassword;

}

/**

* 從SFTP將符合約定命名的文件都下載到本地 .

*

* @param sftpDir

* SFTP服務(wù)器文件存放路徑

* @param locDir

* 本地文件存放路徑

* @param regex

* 指定文件名的格式

* @param needBackup

* 是否需要文件備份(true:是;false:否)

* @param needFullMatch

* 是否要求全局匹配(true:是;false:否)

* @param deleteFtpFile

* the delete ftp file

* @return 下載到本地的文件列表

*/

public ListFile synSFTPFileToLocal(String sftpDir, String locDir, String regex,

boolean needBackup, boolean needFullMatch, boolean deleteFtpFile)

{

ListFile files = new ArrayListFile(KeyConstant.INITIAL_NUMBER);

try

{

this.connect(ip, Integer.parseInt(this.port), userName, password);

// 獲得FTP上文件名稱列表

ListString ftpFileNameList = this.listFiles(sftpDir, regex, needFullMatch);

File localFile = null;

int size = ftpFileNameList.size();

// 根據(jù)每個(gè)FTP文件名稱創(chuàng)建本地文件。

for (int i = 0; i size; i++)

{

// 下載源文件

localFile = this.download(sftpDir, locDir, ftpFileNameList.get(i), deleteFtpFile);

if (localFile.exists())

{

files.add(localFile);

}

if (needBackup)

{

// 備份源文件生成默認(rèn)備份文件路徑(據(jù)請求文件路徑,生成同級(jí)目錄的備份文件夾絕對路徑)

String parentDir = sftpDir.substring(NumberConstant.INT_0,

sftpDir.lastIndexOf("/") + 1);

String backupDir = parentDir + TimetaskConstants.DEFAULT_BACKUP_DIRNAME;

boolean bakExists = openDir(backupDir);

if (bakExists)

{

this.uploadFile(backupDir, localFile);

}

else

{

boolean parentExists = openDir(parentDir);

if (parentExists)

{

s;

this.uploadFile(backupDir, localFile);

}

else

{

DEBUGGER.error("sftp parentDir no exisits ");

}

}

}

}

}

catch (Exception e)

{

DEBUGGER.error("synSFTPFileToLocal Exception", e);

}

finally

{

this.disconnect();

}

return files;

}

/**

* 連接sftp服務(wù)器

*

* @param sftpip

* ip地址

* @param sftpport

* 端口

* @param sftpusername

* 用戶名

* @param sftppassword

* 密碼

* @return channelSftp

* @throws SPMException

*/

public ChannelSftp connect(String sftpip, int sftpport, String sftpusername, String sftppassword)

{

sftp = new ChannelSftp();

try

{

JSch jsch = new JSch();

jsch.getSession(sftpusername, sftpip, sftpport);

Session sshSession = jsch.getSession(sftpusername, sftpip, sftpport);

RUNTIMELOGGER.info("Session created");

sshSession.setPassword(sftppassword);

Properties sshConfig = new Properties();

sshConfig.put("StrictHostKeyChecking", "no");

sshSession.setConfig(sshConfig);

// 設(shè)置超時(shí)時(shí)間為

sshSession.setTimeout(Integer.parseInt(StaticInitData.getFtpConnectTimeOut())

* NumberConstant.INT_1000);

sshSession.connect();

Channel channel = sshSession.openChannel("sftp");

channel.connect();

sftp = (ChannelSftp) channel;

// 設(shè)置文件類型

// ftpClient.setFileType(BINARY_FILE_TYPE);

// 與防火墻相關(guān)

// ftpClient.enterLocalPassiveMode();

}

catch (JSchException e)

{

DEBUGGER.error("JSchException : {}", e);

}

return sftp;

}

// /**

// * 創(chuàng)建指定文件夾

// *

// * @param dirName

// * dirName

// */

// public void mkDir(String dirName)

// {

// try

// {

// s;

// }

// catch (SftpException e)

// {

// DEBUGGER.error("mkDir Exception : " + e);

// }

// }

/**

* 創(chuàng)建指定文件夾

*

* @param dirName

* dirName

*/

public void mkDir(String dirName)

{

String[] dirs = dirName.split("/");

try

{

String now = s;

for (int i = 0; i dirs.length; i++)

{

boolean dirExists = openDir(dirs[i]);

if (!dirExists)

{

s(dirs[i]);

s(dirs[i]);

}

}

s;

}

catch (SftpException e)

{

DEBUGGER.error("mkDir Exception : " + e);

}

}

/**

* 打開指定目錄

*

* @param directory

* directory

* @return 是否打開目錄

*/

public boolean openDir(String directory)

{

try

{

s;

return true;

}

catch (SftpException e)

{

DEBUGGER.error("openDir Exception : " + e);

return false;

}

}

文章標(biāo)題:java代碼連接sftp,java代碼連接不上oracle
網(wǎng)站鏈接:http://chinadenli.net/article4/hddjie.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供搜索引擎優(yōu)化、動(dòng)態(tài)網(wǎng)站全網(wǎng)營銷推廣、品牌網(wǎng)站設(shè)計(jì)、網(wǎng)站改版、網(wǎng)站收錄

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

成都定制網(wǎng)站網(wǎng)頁設(shè)計(jì)