1、sun.net
import sun.net.ftp.*;
import sun.net.*;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
import java.util.StringTokenizer;
/**
FTP 远程命令列表<br>
USER PORT RETR ALLO DELE SITE XMKD CDUP FEAT<br>
PASS PASV STOR REST CWD STAT RMD XCUP OPTS<br>
ACCT TYPE APPE RNFR XCWD HELP XRMD STOU AUTH<br>
REIN STRU SMNT RNTO LIST NOOP PWD SIZE PBSZ<br>
QUIT MODE SYST ABOR NLST MKD XPWD MDTM PROT<br>
在服务器上执行命令,如果用 sendServer 来执行远程命令(不能执行本地 FTP 命令)的话,所
有 FTP 命令都要加上\r\n<br>
ftpclient.sendServer("XMKD /test/bb\r\n"); //执行服务器上的 FTP 命令<br>
ftpclient.readServerResponse 一定要在 sendServer 后调用<br>
nameList("/test")获取指目录下的文件列表<br>
XMKD建立目录,当目录存在的情况下再次创建目录时报错<br> XRMD 删除目录<br>
DELE 删除文件<br>
* <p>Title: 使用 JAVA 操作 FTP 服务器(FTP 客户端)</p>
* <p>Description: 上传文件的类型及文件大小都放到调用此类的方法中去检测,比如放到前台
JAVASCRIPT中去检测等
* 针对 FTP 中的所有调用使用到文件名的地方请使用完整的路径名(绝对路径开始)。
* </p>
* <p>Copyright: Copyright (c) 2005</p>
* <p>Company: 静靖工作室</p>
* @author 欧朝敬 13873195792
* @version 1.0
*/
public class FtpUpfile {
private FtpClient ftpclient;
private String ipAddress;
private int ipPort;
private String userName;
private String PassWord;
/**
* 构造函数
* @param ip String 机器 IP
* @param port String 机器 FTP 端口号 * @param username String FTP 用户名
* @param password String FTP 密码
* @throws Exception
*/
public FtpUpfile(String ip, int port, String username, String password) throws
Exception {
ipAddress = new String(ip);
ipPort = port;
ftpclient = new FtpClient(ipAddress, ipPort);
//ftpclient = new FtpClient(ipAddress);
userName = new String(username);
PassWord = new String(password);
}
/**
* 构造函数
* @param ip String 机器 IP,默认端口为 21
* @param username String FTP 用户名
* @param password String FTP 密码
* @throws Exception
*/
public FtpUpfile(String ip, String username, String password) throws
Exception { ipAddress = new String(ip);
ipPort = 21;
ftpclient = new FtpClient(ipAddress, ipPort);
//ftpclient = new FtpClient(ipAddress);
userName = new String(username);
PassWord = new String(password);
}
/**
* 登录 FTP 服务器
* @throws Exception
*/
public void login() throws Exception {
ftpclient.login(userName, PassWord);
}
/**
* 退出 FTP 服务器
* @throws Exception
*/
public void logout() throws Exception {
//用 ftpclient.closeServer()断开 FTP 出错时用下更语句退出 ftpclient.sendServer("QUIT\r\n");
int reply = ftpclient.readServerResponse(); //取得服务器的返回信息
}
/**
* 在FTP服务器上建立指定的目录,当目录已经存在的情下不会影响目录下的文件,这样用以
判断 FTP
* 上传文件时保证目录的存在目录格式必须以"/"根目录开头
* @param pathList String
* @throws Exception
*/
public void buildList(String pathList) throws Exception {
ftpclient.ascii();
StringTokenizer s = new StringTokenizer(pathList, "/"); //sign
int count = s.countTokens();
String pathName = "";
while (s.hasMoreElements()) {
pathName = pathName + "/" + (String) s.nextElement();
try {
ftpclient.sendServer("XMKD " + pathName + "\r\n");
} catch (Exception e) {
e = null;
} int reply = ftpclient.readServerResponse();
}
ftpclient.binary();
}
/**
* 取得指定目录下的所有文件名,不包括目录名称
* 分析 nameList 得到的输入流中的数,得到指定目录下的所有文件名
* @param fullPath String
* @return ArrayList
* @throws Exception
*/
public ArrayList fileNames(String fullPath) throws Exception {
ftpclient.ascii(); //注意,使用字符模式
TelnetInputStream list = ftpclient.nameList(fullPath);
byte[] names = new byte[2048];
int bufsize = 0;
bufsize = list.read(names, 0, names.length); //从流中读取
list.close();
ArrayList namesList = new ArrayList();
int i = 0;
int j = 0;
while (i < bufsize /*names.length*/) { //char bc = (char) names;
//System.out.println(i + " " + bc + " : " + (int) names);
//i = i + 1;
if (names[i] == 10) { //字符模式为 10,二进制模式为 13
//文件名在数据中开始下标为j,i-j为文件名的长度,文件名在数据中的结束下标为i-1
//System.out.write(names, j, i - j);
//System.out.println(j + " " + i + " " + (i - j));
String tempName = new String(names, j, i - j);
namesList.add(tempName);
//System.out.println(temp);
// 处理代码处
//j = i + 2; //上一次位置二进制模式
j = i + 1; //上一次位置字符模式
}
i = i + 1;
}
return namesList;
}
/**
* 上传文件到 FTP 服务器,destination 路径以 FTP 服务器的"/"开始,带文件名、
* 上传文件只能使用二进制模式,当文件存在时再次上传则会覆盖
* @param source String * @param destination String
* @throws Exception
*/
public void upFile(String source, String destination) throws Exception {
buildList(destination.substring(0, destination.lastIndexOf("/")));
ftpclient.binary(); //此行代码必须放在 buildList 之后
TelnetOutputStream ftpOut = ftpclient.put(destination);
TelnetInputStream ftpIn = new TelnetInputStream(new
FileInputStream(source), true);
byte[] buf = new byte[204800];
int bufsize = 0;
while ((bufsize = ftpIn.read(buf, 0, buf.length)) != -1) {
ftpOut.write(buf, 0, bufsize);
}
ftpIn.close();
ftpOut.close();
}
/**
* JSP 中的流上传到 FTP 服务器,
* 上传文件只能使用二进制模式,当文件存在时再次上传则会覆盖 * 字节数组做为文件的输入流,此方法适用于 JSP 中通过
* request 输入流来直接上传文件在 RequestUpload 类中调用了此方法,
* destination 路径以 FTP 服务器的"/"开始,带文件名
* @param sourceData byte[]
* @param destination String
* @throws Exception
*/
public void upFile(byte[] sourceData, String destination) throws Exception {
buildList(destination.substring(0, destination.lastIndexOf("/")));
ftpclient.binary(); //此行代码必须放在 buildList 之后
TelnetOutputStream ftpOut = ftpclient.put(destination);
ftpOut.write(sourceData, 0, sourceData.length);
// ftpOut.flush();
ftpOut.close();
}
/**
* 从 FTP 文件服务器上下载文件 SourceFileName,到本地 destinationFileName
* 所有的文件名中都要求包括完整的路径名在内
* @param SourceFileName String
* @param destinationFileName String
* @throws Exception
*/ public void downFile(String SourceFileName, String destinationFileName) throws
Exception {
ftpclient.binary(); //一定要使用二进制模式
TelnetInputStream ftpIn = ftpclient.get(SourceFileName);
byte[] buf = new byte[204800];
int bufsize = 0;
FileOutputStream ftpOut = new FileOutputStream(destinationFileName);
while ((bufsize = ftpIn.read(buf, 0, buf.length)) != -1) {
ftpOut.write(buf, 0, bufsize);
}
ftpOut.close();
ftpIn.close();
}
/**
*从 FTP 文件服务器上下载文件,输出到字节数组中
* @param SourceFileName String
* @return byte[]
* @throws Exception
*/
public byte[] downFile(String SourceFileName) throws
Exception {
ftpclient.binary(); //一定要使用二进制模式 TelnetInputStream ftpIn = ftpclient.get(SourceFileName);
ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
byte[] buf = new byte[204800];
int bufsize = 0;
while ((bufsize = ftpIn.read(buf, 0, buf.length)) != -1) {
byteOut.write(buf, 0, bufsize);
}
byte[] return_arraybyte = byteOut.toByteArray();
byteOut.close();
ftpIn.close();
return return_arraybyte;
}
/**调用示例
* FtpUpfile fUp = new FtpUpfile("192.150.189.22", 21, "admin", "admin");
* fUp.login();
* fUp.buildList("/adfadsg/sfsdfd/cc");
* String destination = "/test.zip";
* fUp.upFile("C:\\Documents and Settings\\Administrator\\My
Documents\\sample.zip",destination);
* ArrayList filename = fUp.fileNames("/");
* for (int i = 0; i < filename.size(); i++) { * System.out.println(filename.get(i).toString());
* }
* fUp.logout();
* @param args String[]
* @throws Exception
*/
public static void main(String[] args) throws Exception {
FtpUpfile fUp = new FtpUpfile("172.16.0.142", 22, "ivr", "ivr");
fUp.login();
/* fUp.buildList("/adfadsg/sfsdfd/cc");
String destination = "/test/SetupDJ.rar";
fUp.upFile(
"C:\\Documents and Settings\\Administrator\\My Documents\\SetupDJ.rar",
destination);
ArrayList filename = fUp.fileNames("/");
for (int i = 0; i < filename.size(); i++) {
System.out.println(filename.get(i).toString());
}
fUp.downFile("/sample.zip", "d:\\sample.zip");
*/
FileInputStream fin = new FileInputStream(
"d:\\wapPush.txt"); byte[] data = new byte[20480000];
fin.read(data, 0, data.length);
fUp.upFile(data, "/home/cdr/wapPush.txt");
fUp.logout();
System.out.println("程序运行完成!");
/*FTP 远程命令列表
USER PORT RETR ALLO DELE SITE XMKD CDUP FEAT
PASS PASV STOR REST CWD STAT RMD XCUP OPTS
ACCT TYPE APPE RNFR XCWD HELP XRMD STOU AUTH
REIN STRU SMNT RNTO LIST NOOP PWD SIZE PBSZ
QUIT MODE SYST ABOR NLST MKD XPWD MDTM PROT
*/
/*在服务器上执行命令,如果用sendServer来执行远程命令(不能执行本地FTP命令)的话,
所有 FTP 命令都要加上\r\n
ftpclient.sendServer("XMKD /test/bb\r\n"); //执行服务器上的 FTP 命令
ftpclient.readServerResponse 一定要在 sendServer 后调用
nameList("/test")获取指目录下的文件列表
XMKD建立目录,当目录存在的情况下再次创建目录时报错
XRMD 删除目录
DELE 删除文件
*/ }
}
2、apache 的 common.net
package com.ftp;
import java.io.*;
import java.net.InetAddress;
import org.apache.commons.net.ftp.*;
import org.apache.commons.net.ftp.parser.*;
import org.apache.commons.net.ftp.FTPFile;
import org.apache.commons.net.ftp.FTPFileEntryParser;
import sun.net.TelnetInputStream;
public class FtpAppache {
public FtpAppache() throws Exception{
// sun.net.ftp.FtpClient ft = null;
// TelnetInputStream t = ft.list();
// t.setStickyCRLF(true);
} public void test1() throws Exception {
//
String strTemp = "";
//InetAddress ia = InetAddress.getByName("192.168.0.193");
FTPClient ftp = new FTPClient();
ftp.connect("172.16.0.142",22 );
boolean blogin = ftp.login("ivr ", "ivr");
if (!blogin) {
System.out.println("连接失败");
ftp.disconnect ();
ftp = null;
return;
}
/*//如果是中文名必需进行字符集转换
boolean bMakeFlag = ftp.makeDirectory(new String("测试目录".getBytes(
"gb2312"), "iso-8859-1")); //在服务器创建目录
//上传文件到服务器,目录自由创建
File file = new File("c:\\test.properties");
ftp.storeFile("test.properties",new FileInputStream(file));*/
System.out.println( ftp.getSystemName ()); FTPFile[] ftpFiles = ftp.listFiles ();
if (ftpFiles != null) {
for (int i = 0; i < ftpFiles.length; i++) {
System.out.println(ftpFiles[i].getName());
//System.out.println(ftpFiles[i].isFile());
if (ftpFiles[i].isFile()) {
FTPFile ftpf = new FTPFile();
/*System.err.println(ftpf.hasPermission(FTPFile.GROUP_ACCESS,
FTPFile.EXECUTE_PERMISSION));
System.err.println("READ_PERMISSION="+ftpf.hasPermission(FTPFile.USER_A
CCESS,
FTPFile.READ_PERMISSION));
System.err.println("EXECUTE_PERMISSION="+ftpf.hasPermission(FTPFile.USE
R_ACCESS,
FTPFile.EXECUTE_PERMISSION));
System.err.println("WRITE_PERMISSION="+ftpf.hasPermission(FTPFile.USER_
ACCESS,
FTPFile.WRITE_PERMISSION));
System.err.println(ftpf.hasPermission(FTPFile.WORLD_ACCESS,
FTPFile.READ_PERMISSION));*/
}
//System.out.println(ftpFiles[i].getUser()); }
}
//下载服务器文件
FileOutputStream fos = new FileOutputStream("e:/proftpd-1.2.10.tar.gz");
ftp.retrieveFile("proftpd-1.2.10.tar.gz",fos );
fos.close();
//改变 ftp 目录
//ftp.changeToParentDirectory();//回到父目录
//ftp.changeWorkingDirectory("");//转移工作目录
//ftp.completePendingCommand();//
//删除 ftp 服务器文件
//ftp.deleteFile("");
//注销当前用户,
//ftp.logout();
//ftp.structureMount("");
ftp.disconnect ();
ftp = null;
}
/**
* 封装好的东西是好用,碰到这种问题,我们就。。。up * @param args String[]
*/
public static void main(String[] args) {
try {
FtpAppache ftpAppache1 = new FtpAppache();
ftpAppache1.test1();
}
catch (Exception e) {
e.printStackTrace();
}
}
}
3、edtftpj
package com.boss;
import com.enterprisedt.net.ftp.FTPClient;
import com.enterprisedt.net.ftp.FTPMessageCollector;
import com.enterprisedt.net.ftp.FTPTransferType;
import com.enterprisedt.net.ftp.FTPConnectMode;
import com.enterprisedt.util.debug.Level;
import com.enterprisedt.util.debug.Logger; /**
* Simple test class for FTPClient
*
* @author Hans Andersen
* @author Bruce Blackshaw
*/
public class Demo {
/**
* Revision control id
*/
private static String cvsId = "@(#)$Id: Demo.java,v 1.6 2005/03/18 11:12:56 bruceb Exp
{1}quot;;
/**
* Log stream
*/
private static Logger log = Logger.getLogger(Demo.class);
/**
* Standard main()
*
* @param args standard args */
public static void main(String[] args) {
// assign args to make it clear
String host = "172.16.0.142";
String user = "ivr";
String password = "ivr";
Logger.setLevel(Level.ALL);
FTPClient ftp = null;
try {
// set up client
ftp = new FTPClient();
ftp.setRemoteHost(host );
ftp.setRemotePort(22 );
ftp.setConnectMode(FTPConnectMode.ACTIVE );
FTPMessageCollector listener = new FTPMessageCollector();
ftp.setMessageListener(listener );
//ftp.setAutoPassiveIPSubstitution(true); // connect
log.info("Connecting");
ftp.connect ();
// login
log.info("Logging in");
ftp.login(user , password);
// set up passive ASCII transfers
log.debug("Setting up passive, ASCII transfers");
ftp.setConnectMode(FTPConnectMode.PASV );
ftp.setType(FTPTransferType.ASCII );
// get directory and print it to console
log.debug("Directory before put:");
String[] files = ftp.dir (".", true);
for (int i = 0; i < files.length; i++)
log.debug(files[i]);
// copy file to server
log.info("Putting file");
ftp.put("test.txt ", "test.txt");
// get directory and print it to console
log.debug("Directory after put"); files = ftp.dir (".", true);
for (int i = 0; i < files.length; i++)
log.debug(files[i]);
// copy file from server
log.info("Getting file");
ftp.get("test.txt " + ".copy", "test.txt");
// delete file from server
log.info("Deleting file");
ftp.delete("test.txt ");
// get directory and print it to console
log.debug("Directory after delete");
files = ftp.dir ("", true);
for (int i = 0; i < files.length; i++)
log.debug(files[i]);
// Shut down client
log.info("Quitting client");
ftp.quit ();
String messages = listener.getLog();
log.debug("Listener log:");
log.debug(messages); log.info("Test complete");
} catch (Exception e) {
log.error("Demo failed", e);
}
}
/**
* Basic usage statement
*/
public static void usage() {
System.out.println("Usage: Demo remotehost user password");
}
}
4、sshtools,maverick-ssh.jar
package com.sshtools.examples.echo;
import com.sshtools.j2ssh.configuration.SshConnectionProperties;
import com.sshtools.j2ssh.authentication.*;
import com.sshtools.j2ssh.transport.*;
import com.sshtools.j2ssh.SshException;
import org.apache.log4j.Logger; import java.io.*;
import com.sshtools.j2ssh.subsystem.*;
/**
*
* <p>Echo Client</p>
* <p>Provides a simple example of using the sshtools subsystem framework</p>
* <p>Copyright: Copyright (c) 2002 Lee David Painter</p>
* <p>Company: Sshtools.com</p>
* @author Lee David Painter
* @version 1.0
*/
public class EchoClient extends SubsystemClient {
private static Logger log = Logger.getLogger(EchoClient.class);
/**
* Contructor for the echo client object
*/
public EchoClient() {
super("echo", true);
registerSubsystemMessage(EchoMessage.SSH_ECHO_MESSAGE, EchoMessage.class);
} /**
* Sends a string to the remote ssh server and waits for the same string
* to be echoed back
* @param msg
*/
public void sendEcho(String msg) {
try {
EchoMessage echo = new EchoMessage(msg);
this.sendMessage(echo);
SubsystemMessage reply = nextMessage();
if(reply.getMessageType()== EchoMessage.SSH_ECHO_MESSAGE) {
System.out.println("Server echo> " + ((EchoMessage)reply).getMessage());
}
}
catch(SshException e) {
e.printStackTrace();
}
} /**
* Entry point for the EchoClient sample application
* @param args
*/
public static void main(String args[]) {
try {
org.apache.log4j.BasicConfigurator.configure();
EchoClient client = new EchoClient();
SshConnectionProperties properties = new SshConnectionProperties();
properties.setHost("172.106.0.142");
properties.setUsername("ivr");
final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
client.connect(properties, new HostKeyVerification() {
public void onDeniedHost(String host) {
System.out.println("Access to the host " + host + " is denied from this
system");
}
public void onHostKeyMismatch(String host, String fingerprint, String actual) { try {
System.out.println("The host key supplied by " + host + " is: " + actual);
System.out.println("The current allowed key for " + host + " is: " +
fingerprint);
getResponse(host, actual);
}
catch(Exception e) {
e.printStackTrace();
}
}
private void getResponse(String host, String fingerprint)
throws InvalidHostFileException,
IOException {
String response = "";
while(!(response.equalsIgnoreCase("YES") ||
response.equalsIgnoreCase("NO")
|| response.equalsIgnoreCase("ALWAYS"))) {
System.out.print("Do you want to allow this host key? [Yes|No|Always]:
");
response = reader.readLine();
} if(response.equalsIgnoreCase("YES"))
allowHost(host, fingerprint, false);
if(response.equalsIgnoreCase("NO")) {
System.out.println("Cannot continue without a valid host key");
System.exit(1);
}
if(response.equalsIgnoreCase("ALWAYS"))
allowHost(host, fingerprint, true);
}
public void onUnknownHost(String host, String fingerprint) {
try {
System.out.println("The host " + host + " is currently unknown to the
system");
System.out.println("The host key fingerprint is: " + fingerprint);
getResponse(host, fingerprint);
}
catch(Exception e) {
e.printStackTrace();
} }
});
PasswordAuthentication password = new PasswordAuthentication();
password.setPassword("ivr");
password.setUsername("ivr");
client.authenticate(password);
String message;
do {
System.out.print("Message> ");
message = reader.readLine();
client.sendEcho(message);
} while(!message.equalsIgnoreCase("EXIT"));
client.close();
}
catch(SshException e) {
e.printStackTrace();
}
catch(IOException ioe) { ioe.printStackTrace();
}
}
}
相关推荐
SAP SD实战:用BADI_SLS_HEAD_SCR_CUS给销售订单VA01/VA02加自定义字段(附完整函数组代码)
本文详细解析了在SAP SD模块中如何利用BADI_SLS_HEAD_SCR_CUS实现销售订单(VA01/VA02)的屏幕增强,包括数据结构设计、函数组创建和BADI接口实现。通过实战案例和完整代码,帮助开发者掌握在SAPMV45A标准流程中添加自定义字段的关键技术,提升业务定制化能力。
JAVA实现FTP服务器上文件上传下载以及文件在线预览
(一)介绍文件上传下载: (1)前端思路: 用formData封装好file以及相关参数,然后l利用ajax请求往后台传数据 html的代码: <input id="cm_file" type="file" name="upFileName"> js代码: var formData = new FormData()...
聚类模型-层次聚类
聚类模型 1、层次聚类 2、原型聚类-K-means 3、模型聚类-GMM 4、EM算法-LDA主题模型 5、密度聚类-DBSCAN 6、图聚类-谱聚类 一、层次聚类 一、聚类理论 一般来说,聚类是在训练样本的标签信息不知的情况下,学习样本内在的性质和规律,将有限的集合划分成ccc类。根据“方以类聚,物以群分”的思想,类内对象尽可能的相似,...
Java从FTP服务器中获取PDF文件数据
Java 直接读取本地磁盘的PDF文件很容易,但是要从FTP中获取文件数据缺需要使用工具来连接到FTP服务器,之后才能从中获取到相应的文件数据 操作系统类型:windows 开发工具: idea 项目管理:maven 需要的jar包 <!-- commons jar --> <dependency> <groupId>org.ap...
华为防火墙双ISP出口实战:如何用策略路由实现电信联通流量自动切换(附配置截图)
本文详细解析了华为防火墙在双ISP环境下的智能选路技术,通过策略路由与健康检测的深度应用,实现电信联通流量的自动切换。文章包含实战配置截图,帮助企业解决切换延迟、路径劣化等核心挑战,提升业务连续性。
华为海思IC前端中后端(COT&XPU)岗位笔试机考题
华为海思COT和XPU部门IC前端,IC中端,IC后端岗位笔试真题分享
Java实现Ftp文件下载及图片预览
通过浏览器的方式下载ftp文件及图片流方式实现页面预览FTP图片
晶体管-二极管三极管MOS管选型参数总结
二极管三极管和MOS管,是电路中常用的控制电流电压的基本电子元器件。电路世界中晶体管的选型,需要考虑的参数多种多样,这些参数的选择会直接影响到电路的性能、稳定性、成本等多个方面。本文对二极管三极管和MOS管的选型参数进行详细介绍并总结。
java读取pdf文件内容
java读取pdf文件内容 在java中要读取pdf文件内容,我们可以借助第三方软件实现。常用的是xpdf,本文就简单介绍在linux下如何安装xpdf,及在java中如何利用xpdf读取pdf文件内容。一.安装xpdf 在fc系列下,不用安装,可以直接yum,但是笔者建议还是下载安装的好,因为笔者曾经碰到过这样的问题,客户服务器上的xpdf是yum安装的,有
【Python计量】linearmodels面板数据回归(一)
我们以伍德里奇《计量经济学导论现代方法》的”第14章高级面板数据方法“的案例14.1为例,使用jtrain中的数据来进行固定效应估计。
【部署优化篇三】《DeepSeek边缘计算实战:把目标检测模型塞进树莓派,让AI在巴掌大的设备上“开天眼“》
谁说只有超级计算机才能跑AI?今天咱们就要在树莓派上玩转DeepSeek目标检测,让这个巴掌大的小盒子变成会‘看’世界的智能终端!本文手把手教你从零开始,把最潮的目标检测模型塞进树莓派。全程高能预警,建议准备好你的树莓派4B/5和散热风扇,咱们这就开启边缘计算的魔法之旅!
java 文件上传到ftp_java上传文件到FTP
import java.io.File;import java.io.FileInputStream;import java.io.FileOutputStream;import java.io.IOException;import java.io.OutputStream;import org.apache.commons.net.ftp.FTPClient;import org.apache....
QGIS编译(跨平台编译)之五十六:QScintilla编译、QScintilla安装(Windows、Linux、MacOS环境下编译、安装)
QGIS编译;QScintilla编译、QScintilla安装(Windows、Linux、MacOS环境下编译、安装)
HTML转PDF并上传FTP(1)
准备工作: 1.安装插件wkhtmltopdf,URL:https://wkhtmltopdf.org/downloads.html 2.导包 jsch-0.1.54.jar URL:http://www.jcraft.com/jsch/ 代码片段 /*wkhtmltopdf在linux服务器中的路径/ private static final String toPdf
怀旧版电脑GBC模拟器
再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。
精雕软件(JDpaint) 5.5 绿色版
精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版
java实现url的word地址转换为pdf文件操作(文件最终存储ftp里nginx映射展示,项目部署到k8s里)
上周分配的任务功能是将word转化为pdf文件,在转换的过程中还需要替换文档内容(ps不会将原有内容文档更改),查询了一些资料发现java还是蛮难实现的,资料也是不多的,尤其我们的环境还是k8s里部署,就增大了很多困难,实践了很久最终成功将word转换成pdf文件了。 首先给我的word地址是url方式的地址,"http://ip/文件名称.docx"的http方式,我需要请求这个地址转换成in...
蓝牙模块HM-10手册
蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。
实现FTP服务器免登陆下载PDF文件转base64在下载到本地|服务器
最近碰到一个问题,就是实现调用FTP服务器免登陆下载在进行展示,在这里分享下源码,能帮助到你的请点个赞呐呐呐! 上源码+注释 import java.io.ByteArrayOutputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import...
IMSL CNL 7.0.0 (x86-64)Crack
IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件
从FTP获取PDF文件流并展示到页面
背景描述:从FTP获取PDF,并将其展示到页面,以达到预览的效果 Java:代码 ftpClient.connnect(ip,port); ftpClient.setFileType(FTP,.BINARY_FILE_TYPE); ftpClient.login(userId,password); ftpClient.changeWorkingDirec
Spring Boot 读取 FTP文件
需求:从FTP文件服务器里获取PDF文件。2、配置properties文件。废话不多说,直接开干。
ftp工具类
import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.InetSocketAdd...
【技术底稿 18】FTP 文件处理 + LibreOffice Word 转 PDF 在线预览 + 集群乱码终极排查全记录
本文为后端通用文件处理实战复盘,基于 LibreOffice 实现 FTP 存储 Word 转 PDF 在线预览能力,支持 iframe 直连预览与下载双模式。完整排查 FTP 连接污染、分布式集群交替乱码问题,深度定位字体渲染根因并完成根治,沉淀 FTP 开发规范与集群环境一致性运维可复用经验。
word转pdf实现总结
之前项目有需求,要求java代码实现word转pdf功能.调研了很多技术都不是很成熟.特别是中文乱码的问题.大部分框架都是在中文环节出了问题.(我很奢望我能出生在一个英语国度).最终的技术选型是利用jacob实现word转pdf功能.但是服务器部署在linux服务器上.所以又产生了新的问题就是:linux和windows交互文件.这个问题还是比较容易解决的.windows上用的是pscp.exe向
【java】简单的文件加密解密方式
简单的文件加密解密方式
SPRINGMVC实现在线预览功能(openOffice)
这两天因业务需要,做了个在线预览的功能。其实在线预览本身并不复杂,只要调用相应的控件即可完成。 因为文件在FTP服务器上,所以我现将FTP服务器上相对应的文件下载到本地工程文件夹里(resource/pdf/),然后再在本地通过OpenOffice将word文件(本文以word为例)转换成PDF文件,在JSP页面通过pdfobject.js将resource/pdf/下对应的文件取出,预览。不多说
访问登录linux预览文件,包括图片,pdf,word
话不多说,上代码 public static FTPClientForTree getInstance() { if (ftpClientUtil == null) { ftpClientUtil = new FTPClientForTree(); } return ftpClientUtil; } FTPClientForTree.getInstance(). viewImage(orderFileReport.getFilePath(),orderFileReport.ge
【四、java实现气象预报数据micaps-diamond4的数据解析入库】
此类数据处理的核心重点,数据解析入库存在数据实时更新的情况,那么数据库表中的数据要进行实时更新覆盖才可以哦!第二类:实时数据:ZLkFile/JmDx2019 and ZLkFile/ZdDx2019。第二类:实时数据:ZLkFile/ScZdJmDxZLk/ZdDx2022。数据可能存在修改覆盖的情况,要使用定时任务实现数据不断的覆盖更新。第一类:气象预报数据:JC_Rain//diamond4。第一类:气象预报数据:JC_Rain//diamond4。第三类:气象天气预报文档数据:tqyb。
Mail工具类
1.mailimport java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Properties; import javax.mail...
368



被折叠的 条评论
为什么被折叠?



