- 浏览: 116886 次
- 性别:
- 来自: 广州
文章分类
- 全部博客 (130)
- JUnit4学习 (0)
- Spring3.X学习 (2)
- 日记 (1)
- 文学类 (2)
- Java (15)
- Thingking In Java (11)
- org.apache.poi (4)
- XML (2)
- Log4j (1)
- Jar包收集 (2)
- ExtJs (1)
- 汇编语言 (11)
- 开发工具 (0)
- 电子书 (2)
- Oracle (6)
- Ajax (1)
- Jquery (2)
- myBatis (1)
- Spring2.5学习 (6)
- Tomcat (1)
- MyEclipse (1)
- JSP (1)
- Linux shell 脚本攻略 (7)
- Python3 (2)
- HTML5 (5)
- JavaScript (7)
- Hadoop-1.2.1 (2)
- Python2.7 (12)
- Django (3)
- 软件安装 (1)
- 高级Bash脚本编程指南 (7)
- Linux命令 (3)
- Ansible (2)
- MySQL (2)
- 病历 (1)
- 操作系统 (1)
- CSS (0)
- CSS3 (0)
- 面试题 (1)
最新评论
-
hw1287789687:
http://www.cnblogs.com/hccwu/p/ ...
Java获取真实的IP地址 -
liubey:
String ip = request.getHeader(& ...
Java获取真实的IP地址 -
bewithme:
我记得uploadify这破东西只能在chrome浏览器中才有 ...
Struts2结合Jquery.uploadify上传插件的应用 -
MrLee23:
http://mrlee23.iteye.com/admin/ ...
Struts2结合Jquery.uploadify上传插件的应用 -
crysik:
import com.eshore.ppm.model.com ...
Struts2结合Jquery.uploadify上传插件的应用
//Java利用第三方jar包(ganymed-ssh2-build210.jar)读取远程主机文件
package com.poson.cb.web.action.bill;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.io.PrintWriter;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Properties;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import ch.ethz.ssh2.Connection;
import ch.ethz.ssh2.SFTPv3Client;
import ch.ethz.ssh2.SFTPv3FileAttributes;
import ch.ethz.ssh2.Session;
import ch.ethz.ssh2.StreamGobbler;
import com.poson.cb.ext.domain.RealTimeBilling;
import com.poson.cb.lib.dr.DRApiHPImpl;
import com.poson.cb.service.AppException;
import com.poson.cb.web.action.BaseAction;
//实时清,账单文件查询
public class RealTimeBillingAction extends BaseAction{
Runtime runtime=Runtime.getRuntime();
String useHome=System.getProperty("user.home");
String idxMasterPath = useHome+"ADR/cb/data/master/"; //主侧IDX文件路径
String idxSlavePath = useHome+"ADR/cb/data/slave/"; //备侧文件路径
String[] fileDirName={"bill","mobile","fixed","fileout"};
short outTime=2; //设置超时时间为2分钟
String shIsMaster="Master"; //当前主侧默认是上海
Connection con=null;
public ActionForward realTimeActionForward(ActionMapping actionMapping,
ActionForm actionForm, HttpServletRequest request,
HttpServletResponse response) throws AppException, Exception {
List bjList=new ArrayList();
List shList=new ArrayList();
InetAddress address=InetAddress.getLocalHost();
// 1.0 获取主备角色
short sysSate = new DRApiHPImpl().getSystemState();
System.out.println("第三种方法获得主备角色:" + sysSate); // 0-主系统,1-备系统,2-非融灾系统
//判断上海是否是主侧
if(sysSate==1 && (getCurrentHostAddress().equals("132.32.24.105"))){
shIsMaster="slave";
}
// 2.0 获取当前侧容灾平台正在处理的IDX(文件)名称
Process p1 = runtime
.exec(new String[] { "/bin/sh", "-c", "dr_stat -l" });
BufferedReader bReader = new BufferedReader(new InputStreamReader(p1
.getInputStream()));
String firstLine = bReader.readLine();
// 读取第二行的记录(第一行为unix返回的列)
while ((firstLine = bReader.readLine()) != null) {
String[] arrs = firstLine.split("\\s{1,}"); // 以空格为分隔符
// 获取IDX文件名
String idxName = arrs[0];
if(idxName != null && !"".equals(idxName)){
//得到当前侧的文件集合
RealTimeBilling billing=getFileNameListByIdxOfCurr(idxName.trim(),sysSate);
if(null !=billing){
if(getCurrentHostAddress().equals("132.129.24.18") || getCurrentHostAddress().equals("132.129.24.5")){
shList.add(billing);
}else {
bjList.add(billing);
}
}
}
}
// 获得对端侧文件集合
short endSysStat;
if(sysSate==0){
endSysStat=1;
}else {
endSysStat=0;
}
Session session=getEndtoSession();
//获取对端idxName
session.execCommand("dr_stat -l");
BufferedReader bReader2=new BufferedReader(new InputStreamReader(session.getStdout()));
String endFirstLine = bReader2.readLine();
while((endFirstLine=bReader2.readLine())!=null){
String[] endArrs = endFirstLine.split("\\s{1,}"); // 以空格为分隔符
// 获取IDX文件名
String endIdxName = endArrs[0].trim();
RealTimeBilling billing1 =getFileNameListByIdxOfEnd(session, endIdxName, endSysStat);
if(null !=billing1){
if(getCurrentHostAddress().equals("132.129.24.18") || getCurrentHostAddress().equals("132.129.24.5")){
bjList.add(billing1);
}else {
shList.add(billing1);
}
}
}
session.close();
p1.destroy();
request.setAttribute("bjList", bjList);
request.setAttribute("shList", shList);
request.setAttribute("shIsMaster", shIsMaster);
return actionMapping.findForward("realTimeBilling");
}
//设置跳转方法
public ActionForward realTimeForward(ActionMapping actionMapping,
ActionForm actionForm, HttpServletRequest request,
HttpServletResponse response) throws AppException, Exception {
request.setAttribute("bjList", "");
request.setAttribute("shList", "");
request.setAttribute("shIsMaster", "");
return actionMapping.findForward("realTimeForward");
}
// 获得对端session
public Session getEndtoSession(){
String hAddress = "";
String ip,user,pwd;
Session session=null;
try {
//InetAddress iAddress = InetAddress.getLocalHost();
hAddress =getCurrentHostAddress();
System.out.println("本机的IP地址是:" + hAddress);
String ipConfigFile = useHome + "web" + File.separator + "CB"
+ File.separator + "WEB-INF" + File.separator
+ "ipconfig.properties";
Properties properties = new Properties();
properties.load(new FileInputStream(ipConfigFile));
if (hAddress.equals("132.129.24.18") || hAddress.equals(properties.get("sIp").toString().trim())) {
ip=properties.get("bIp").toString().trim();
user=properties.get("bUser").toString().trim();
pwd=properties.get("bPwd").toString().trim();
} else {
ip=properties.get("sIp").toString().trim();
user=properties.get("sUser").toString().trim();
pwd=properties.get("sPwd").toString().trim();
}
System.out.println("对端服务器的IP="+ip+" 用户名:"+user+" 密码:"+pwd);
con=new Connection(ip);
con.connect();
boolean isAuthenticate=con.authenticateWithPassword(user, pwd);
if(isAuthenticate==false){
System.out.println("连接对端服务器认证失败......");
throw new IOException("Authentication failed....");
}
session=con.openSession();
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return session;
}
//获取对端文件集合
public List getEndToFileNameList(){
Session session=getEndtoSession();
//1.0 获得对端侧
return null;
}
//这种方法可以获得主备系统
public String getMachineRole(){
String mRole="";
try {
String drStatStr="dr_stat -d|head -n1|sed 's/^.*=//'|tr [A-Z] [a-z]";
Process p2=Runtime.getRuntime().exec(new String[]{"/bin/sh","-c",drStatStr});
InputStreamReader inReader=new InputStreamReader(p2.getInputStream());
LineNumberReader lReader=new LineNumberReader(inReader);
p2.waitFor();
while((mRole=lReader.readLine()) !=null){
System.out.println("用第二种方法获得主机角色:"+mRole);
}
} catch (IOException e) {
System.out.println("用第二种方法获得主机角色失败");
e.printStackTrace();
} catch (InterruptedException e) {
System.out.println("用第二种方法获得主机角色失败");
e.printStackTrace();
}
//output :master
return mRole;
}
//通过文件idxName查找对应的文件名称
public RealTimeBilling getFileNameListByIdxOfCurr(String idxName,int sysStat) throws Exception{
RealTimeBilling rBilling=null;
for (int i = 0; i < fileDirName.length; i++) {
String filePath="";
if(sysStat==0){
//在主侧目录查找
filePath=idxMasterPath+fileDirName[i]+File.separator+idxName;
}else if (sysStat==1) {
//在备侧目录查找
filePath=idxSlavePath+fileDirName[i]+File.separator+"processing"+File.separator+idxName;
}
File file=new File(filePath);
if(file.exists()){
rBilling=new RealTimeBilling();
System.out.println("打印文件所在目录:"+file.getPath());
//读取idx文件并获取文件名称
LineNumberReader lNumberReader=new LineNumberReader(new FileReader(file));
String linInfo ="";
while((linInfo=lNumberReader.readLine())!=null){
if(linInfo.indexOf("FILE_NAME")>0){
String fileName=lNumberReader.readLine().trim();
rBilling.setFileName(fileName);
if((Calendar.getInstance().getTimeInMillis()-file.lastModified())/1000/60 > outTime){
rBilling.setOutTime(true);
}else {
rBilling.setOutTime(false);
}
System.out.println("打印当前侧文件名称:"+fileName +"是否超过2分钟:"+rBilling.isOutTime());
break;
}
}
}
}
return rBilling;
}
//在对端侧查找对应的文件
public RealTimeBilling getFileNameListByIdxOfEnd(Session session ,String idxName,short sysStat) throws Exception{
RealTimeBilling rBilling=null;
for (int i = 0; i < fileDirName.length; i++) {
String filePath="";
if(sysStat==0){
//在主侧目录查找
filePath=idxMasterPath+fileDirName[i];
}else if (sysStat==1) {
//在备侧目录查找
filePath=idxSlavePath+fileDirName[i]+File.separator+"processing";
}
session.execCommand("find "+filePath+" -name "+idxName);
BufferedReader bReader1=new BufferedReader(new InputStreamReader(new StreamGobbler(session.getStdout()))) ;
String pathStr;
while((pathStr=bReader1.readLine())!=null){
session.execCommand("cat "+pathStr);
BufferedReader bReader2=new BufferedReader(new InputStreamReader(new StreamGobbler(session.getStdout()))) ;
String endFileLine;
while((endFileLine=bReader2.readLine())!=null){
if(endFileLine.indexOf("FILE_NAME")>0){
String fileName=bReader2.readLine().trim();
System.out.println("对端提取的文件名称为:"+fileName);
rBilling=new RealTimeBilling();
rBilling.setFileName(fileName);
SFTPv3FileAttributes sAttributes= new SFTPv3Client(con).lstat(filePath);
Integer mtime= sAttributes.mtime; //获得文件的修改时间 需要确认返回的值是否以毫秒为单位
if(((Calendar.getInstance().getTimeInMillis()-Long.parseLong(mtime.toString()))/1000/60) > outTime){
rBilling.setOutTime(true);
}else {
rBilling.setOutTime(false);
}
System.out.println("对端提取的idxName文件所在路径为:"+filePath +" 该文件的访问时间为:"+mtime +" 是否超时:"+rBilling.isOutTime());
break;
}
}
}
}
return rBilling;
}
public String getCurrentHostAddress(){
String hoString="";
try {
InetAddress iAddress=InetAddress.getLocalHost();
hoString= iAddress.getHostAddress();
} catch (UnknownHostException e) {
System.out.println("获取本机IP地址出错错误......");
e.printStackTrace();
}
return hoString;
}
public static void main(String[] args) {
new RealTimeBillingAction().getEndtoSession();
}
}
利用第三方jar包(ganymed-ssh2-build210.jar)读取远程主机文件的主要步骤为:
1.0 获得session
con=new ch.ethz.ssh2.Connection(ip);
con.connect();
boolean isAuthenticate=con.authenticateWithPassword(user, pwd);
session=con.openSession();
2.0 通过session执行命令并读取返回结果
session.execCommand("find "+filePath+" -name "+idxName);
BufferedReader bReader1=new BufferedReader(new InputStreamReader(new StreamGobbler(session.getStdout()))) ;
2013-09-19 0:19 记 @sanliheludongkou.xichengqu.beijing
package com.poson.cb.web.action.bill;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.io.PrintWriter;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Properties;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import ch.ethz.ssh2.Connection;
import ch.ethz.ssh2.SFTPv3Client;
import ch.ethz.ssh2.SFTPv3FileAttributes;
import ch.ethz.ssh2.Session;
import ch.ethz.ssh2.StreamGobbler;
import com.poson.cb.ext.domain.RealTimeBilling;
import com.poson.cb.lib.dr.DRApiHPImpl;
import com.poson.cb.service.AppException;
import com.poson.cb.web.action.BaseAction;
//实时清,账单文件查询
public class RealTimeBillingAction extends BaseAction{
Runtime runtime=Runtime.getRuntime();
String useHome=System.getProperty("user.home");
String idxMasterPath = useHome+"ADR/cb/data/master/"; //主侧IDX文件路径
String idxSlavePath = useHome+"ADR/cb/data/slave/"; //备侧文件路径
String[] fileDirName={"bill","mobile","fixed","fileout"};
short outTime=2; //设置超时时间为2分钟
String shIsMaster="Master"; //当前主侧默认是上海
Connection con=null;
public ActionForward realTimeActionForward(ActionMapping actionMapping,
ActionForm actionForm, HttpServletRequest request,
HttpServletResponse response) throws AppException, Exception {
List bjList=new ArrayList();
List shList=new ArrayList();
InetAddress address=InetAddress.getLocalHost();
// 1.0 获取主备角色
short sysSate = new DRApiHPImpl().getSystemState();
System.out.println("第三种方法获得主备角色:" + sysSate); // 0-主系统,1-备系统,2-非融灾系统
//判断上海是否是主侧
if(sysSate==1 && (getCurrentHostAddress().equals("132.32.24.105"))){
shIsMaster="slave";
}
// 2.0 获取当前侧容灾平台正在处理的IDX(文件)名称
Process p1 = runtime
.exec(new String[] { "/bin/sh", "-c", "dr_stat -l" });
BufferedReader bReader = new BufferedReader(new InputStreamReader(p1
.getInputStream()));
String firstLine = bReader.readLine();
// 读取第二行的记录(第一行为unix返回的列)
while ((firstLine = bReader.readLine()) != null) {
String[] arrs = firstLine.split("\\s{1,}"); // 以空格为分隔符
// 获取IDX文件名
String idxName = arrs[0];
if(idxName != null && !"".equals(idxName)){
//得到当前侧的文件集合
RealTimeBilling billing=getFileNameListByIdxOfCurr(idxName.trim(),sysSate);
if(null !=billing){
if(getCurrentHostAddress().equals("132.129.24.18") || getCurrentHostAddress().equals("132.129.24.5")){
shList.add(billing);
}else {
bjList.add(billing);
}
}
}
}
// 获得对端侧文件集合
short endSysStat;
if(sysSate==0){
endSysStat=1;
}else {
endSysStat=0;
}
Session session=getEndtoSession();
//获取对端idxName
session.execCommand("dr_stat -l");
BufferedReader bReader2=new BufferedReader(new InputStreamReader(session.getStdout()));
String endFirstLine = bReader2.readLine();
while((endFirstLine=bReader2.readLine())!=null){
String[] endArrs = endFirstLine.split("\\s{1,}"); // 以空格为分隔符
// 获取IDX文件名
String endIdxName = endArrs[0].trim();
RealTimeBilling billing1 =getFileNameListByIdxOfEnd(session, endIdxName, endSysStat);
if(null !=billing1){
if(getCurrentHostAddress().equals("132.129.24.18") || getCurrentHostAddress().equals("132.129.24.5")){
bjList.add(billing1);
}else {
shList.add(billing1);
}
}
}
session.close();
p1.destroy();
request.setAttribute("bjList", bjList);
request.setAttribute("shList", shList);
request.setAttribute("shIsMaster", shIsMaster);
return actionMapping.findForward("realTimeBilling");
}
//设置跳转方法
public ActionForward realTimeForward(ActionMapping actionMapping,
ActionForm actionForm, HttpServletRequest request,
HttpServletResponse response) throws AppException, Exception {
request.setAttribute("bjList", "");
request.setAttribute("shList", "");
request.setAttribute("shIsMaster", "");
return actionMapping.findForward("realTimeForward");
}
// 获得对端session
public Session getEndtoSession(){
String hAddress = "";
String ip,user,pwd;
Session session=null;
try {
//InetAddress iAddress = InetAddress.getLocalHost();
hAddress =getCurrentHostAddress();
System.out.println("本机的IP地址是:" + hAddress);
String ipConfigFile = useHome + "web" + File.separator + "CB"
+ File.separator + "WEB-INF" + File.separator
+ "ipconfig.properties";
Properties properties = new Properties();
properties.load(new FileInputStream(ipConfigFile));
if (hAddress.equals("132.129.24.18") || hAddress.equals(properties.get("sIp").toString().trim())) {
ip=properties.get("bIp").toString().trim();
user=properties.get("bUser").toString().trim();
pwd=properties.get("bPwd").toString().trim();
} else {
ip=properties.get("sIp").toString().trim();
user=properties.get("sUser").toString().trim();
pwd=properties.get("sPwd").toString().trim();
}
System.out.println("对端服务器的IP="+ip+" 用户名:"+user+" 密码:"+pwd);
con=new Connection(ip);
con.connect();
boolean isAuthenticate=con.authenticateWithPassword(user, pwd);
if(isAuthenticate==false){
System.out.println("连接对端服务器认证失败......");
throw new IOException("Authentication failed....");
}
session=con.openSession();
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return session;
}
//获取对端文件集合
public List getEndToFileNameList(){
Session session=getEndtoSession();
//1.0 获得对端侧
return null;
}
//这种方法可以获得主备系统
public String getMachineRole(){
String mRole="";
try {
String drStatStr="dr_stat -d|head -n1|sed 's/^.*=//'|tr [A-Z] [a-z]";
Process p2=Runtime.getRuntime().exec(new String[]{"/bin/sh","-c",drStatStr});
InputStreamReader inReader=new InputStreamReader(p2.getInputStream());
LineNumberReader lReader=new LineNumberReader(inReader);
p2.waitFor();
while((mRole=lReader.readLine()) !=null){
System.out.println("用第二种方法获得主机角色:"+mRole);
}
} catch (IOException e) {
System.out.println("用第二种方法获得主机角色失败");
e.printStackTrace();
} catch (InterruptedException e) {
System.out.println("用第二种方法获得主机角色失败");
e.printStackTrace();
}
//output :master
return mRole;
}
//通过文件idxName查找对应的文件名称
public RealTimeBilling getFileNameListByIdxOfCurr(String idxName,int sysStat) throws Exception{
RealTimeBilling rBilling=null;
for (int i = 0; i < fileDirName.length; i++) {
String filePath="";
if(sysStat==0){
//在主侧目录查找
filePath=idxMasterPath+fileDirName[i]+File.separator+idxName;
}else if (sysStat==1) {
//在备侧目录查找
filePath=idxSlavePath+fileDirName[i]+File.separator+"processing"+File.separator+idxName;
}
File file=new File(filePath);
if(file.exists()){
rBilling=new RealTimeBilling();
System.out.println("打印文件所在目录:"+file.getPath());
//读取idx文件并获取文件名称
LineNumberReader lNumberReader=new LineNumberReader(new FileReader(file));
String linInfo ="";
while((linInfo=lNumberReader.readLine())!=null){
if(linInfo.indexOf("FILE_NAME")>0){
String fileName=lNumberReader.readLine().trim();
rBilling.setFileName(fileName);
if((Calendar.getInstance().getTimeInMillis()-file.lastModified())/1000/60 > outTime){
rBilling.setOutTime(true);
}else {
rBilling.setOutTime(false);
}
System.out.println("打印当前侧文件名称:"+fileName +"是否超过2分钟:"+rBilling.isOutTime());
break;
}
}
}
}
return rBilling;
}
//在对端侧查找对应的文件
public RealTimeBilling getFileNameListByIdxOfEnd(Session session ,String idxName,short sysStat) throws Exception{
RealTimeBilling rBilling=null;
for (int i = 0; i < fileDirName.length; i++) {
String filePath="";
if(sysStat==0){
//在主侧目录查找
filePath=idxMasterPath+fileDirName[i];
}else if (sysStat==1) {
//在备侧目录查找
filePath=idxSlavePath+fileDirName[i]+File.separator+"processing";
}
session.execCommand("find "+filePath+" -name "+idxName);
BufferedReader bReader1=new BufferedReader(new InputStreamReader(new StreamGobbler(session.getStdout()))) ;
String pathStr;
while((pathStr=bReader1.readLine())!=null){
session.execCommand("cat "+pathStr);
BufferedReader bReader2=new BufferedReader(new InputStreamReader(new StreamGobbler(session.getStdout()))) ;
String endFileLine;
while((endFileLine=bReader2.readLine())!=null){
if(endFileLine.indexOf("FILE_NAME")>0){
String fileName=bReader2.readLine().trim();
System.out.println("对端提取的文件名称为:"+fileName);
rBilling=new RealTimeBilling();
rBilling.setFileName(fileName);
SFTPv3FileAttributes sAttributes= new SFTPv3Client(con).lstat(filePath);
Integer mtime= sAttributes.mtime; //获得文件的修改时间 需要确认返回的值是否以毫秒为单位
if(((Calendar.getInstance().getTimeInMillis()-Long.parseLong(mtime.toString()))/1000/60) > outTime){
rBilling.setOutTime(true);
}else {
rBilling.setOutTime(false);
}
System.out.println("对端提取的idxName文件所在路径为:"+filePath +" 该文件的访问时间为:"+mtime +" 是否超时:"+rBilling.isOutTime());
break;
}
}
}
}
return rBilling;
}
public String getCurrentHostAddress(){
String hoString="";
try {
InetAddress iAddress=InetAddress.getLocalHost();
hoString= iAddress.getHostAddress();
} catch (UnknownHostException e) {
System.out.println("获取本机IP地址出错错误......");
e.printStackTrace();
}
return hoString;
}
public static void main(String[] args) {
new RealTimeBillingAction().getEndtoSession();
}
}
利用第三方jar包(ganymed-ssh2-build210.jar)读取远程主机文件的主要步骤为:
1.0 获得session
con=new ch.ethz.ssh2.Connection(ip);
con.connect();
boolean isAuthenticate=con.authenticateWithPassword(user, pwd);
session=con.openSession();
2.0 通过session执行命令并读取返回结果
session.execCommand("find "+filePath+" -name "+idxName);
BufferedReader bReader1=new BufferedReader(new InputStreamReader(new StreamGobbler(session.getStdout()))) ;
2013-09-19 0:19 记 @sanliheludongkou.xichengqu.beijing
- ganymed-ssh2-build210.rar (556.3 KB)
- 下载次数: 16
发表评论
-
Java RMI远程调用
2015-09-15 19:16 928具体代码: 首先定义 ... -
java.lang.IllegalArgumentException: Illegal group reference
2015-02-01 23:34 500public static void main(String ... -
Java对session的监控
2015-01-12 15:37 1398在Java中可以使用 javax.servlet.http. ... -
Java获取真实的IP地址
2014-12-18 14:58 789// 获取真实IP的方法() public String ... -
Java某个账期月的最大天数
2014-12-18 14:50 898/* * 获取某个账期月的最大天数 * param:s ... -
Java String类型赋值问题
2014-10-23 15:34 1100今天用POI在做Ex ... -
获取类所引用的jar包
2014-09-04 11:35 558System.out.println("HWPFD ... -
批量修改文件名称
2014-09-04 11:13 326package mp3; import java.io.Fi ... -
Java获取系统属性
2013-10-24 11:59 1320package com; public class Vers ... -
java.sql.SQLException: 结果集已耗尽
2013-10-22 00:42 151392013年10月21日 星期一 21时43分23秒 说明: ... -
Java时间处理集合
2013-08-27 23:46 819package collections; import ja ... -
ORA-01013: user requested cancel of current operation
2013-08-19 17:01 32472013年8月19日 星期一 16时16分04 ... -
Java 实现一个Null接口
2013-07-02 00:10 578注: 以下代码来自:《Thinking in Java Fo ... -
Java Class.forName()无法加载类
2013-06-26 00:41 16122013年6月26日 星期三 1时01分42秒 packag ...
相关推荐
JAVA实现远程文件读取
java 读取 各平台 服务器硬件信息(windowx+linux+Mac OS) 案例............。
java实现从远程主机读取文件并且拷贝到本地,压缩包里有需要用到的jar包和源码
Java读写文本文件的示例代码 1个目标文件。 java俄罗斯方块 一个目标文件。 Java非对称加密源码实例 1个目标文件 摘要:Java源码,算法相关,非对称加密 Java非对称加密源程序代码实例,本例中使用RSA加密技术,...
Java读写文本文件的示例代码 1个目标文件。 java俄罗斯方块 一个目标文件。 Java非对称加密源码实例 1个目标文件 摘要:Java源码,算法相关,非对称加密 Java非对称加密源程序代码实例,本例中使用RSA加密技术,...
使用wmi4j 连接远程主机获取进程列表,创建文件夹、共享文件夹、执行netstat -ano输出到aa.txt文件,读取文件、撤销文件夹共享、删除文件夹及aa.txt文件;即实现远程执行cmd命令获取命令执行的结果的效果。
Java读写文本文件的示例代码 1个目标文件。 java俄罗斯方块 一个目标文件。 Java非对称加密源码实例 1个目标文件 摘要:Java源码,算法相关,非对称加密 Java非对称加密源程序代码实例,本例中使用RSA加密技术,...
Java读写文本文件的示例代码 1个目标文件。 java俄罗斯方块 一个目标文件。 Java非对称加密源码实例 1个目标文件 摘要:Java源码,算法相关,非对称加密 Java非对称加密源程序代码实例,本例中使用RSA加密技术...
Java读写文本文件的示例代码 1个目标文件。 java俄罗斯方块 一个目标文件。 Java非对称加密源码实例 1个目标文件 摘要:Java源码,算法相关,非对称加密 Java非对称加密源程序代码实例,本例中使用RSA加密技术...
* SCP远程访问Linux服务器读取文件 * User: boyer * Date: 17-12-7 * Time: 下午3:22 * To change this template use File | Settings | File Templates. */ public class ScpClient { //字符编码默认是utf-...
Java读写文本文件的示例代码 1个目标文件。 java俄罗斯方块 一个目标文件。 Java非对称加密源码实例 1个目标文件 摘要:Java源码,算法相关,非对称加密 Java非对称加密源程序代码实例,本例中使用RSA加密技术...
本设计主要实现基于JAVA的本地端口监听与远程主机端口扫描功能。本地端口监听用于监控本机某一端口是否有连接请求,远程端口扫描用于检测远程主机开放的端口情况。 本地端口监听实现通过JAVA的ServerSocket类,创建...
Java从网络取得文件 1个目标文件 简单 Java从压缩包中提取文件 1个目标文件 简单 Java存储与读取对象 1个目标文件 如题 Java调色板面板源代码 1个目标文件 摘要:Java源码,窗体界面,调色板 使用Java语言编写的一款...
Java读写文本文件的示例代码 1个目标文件。 java俄罗斯方块 一个目标文件。 Java非对称加密源码实例 1个目标文件 摘要:Java源码,算法相关,非对称加密 Java非对称加密源程序代码实例,本例中使用RSA加密技术,...
Java从网络取得文件 1个目标文件 简单 Java从压缩包中提取文件 1个目标文件 简单 Java存储与读取对象 1个目标文件 如题 Java调色板面板源代码 1个目标文件 摘要:Java源码,窗体界面,调色板 使用Java语言编写的一款...
java连接Redis服务器端的示例工程,演示了通过Redisson 连接redis服务器的读取与存储代码
本程序采用Java编写ftp 命令使用“文件传送协议” (FTP) 在本地和远程主机或远程主机之间传送文件。 FTP 协议允许在使用不同文件系统的主机之间进行数据传送。尽管协议在传送数据中提供了很高的灵活度,它仍然不会...