- 浏览: 226803 次
- 性别:
- 来自: 杭州
-
文章分类
- 全部博客 (163)
- c++ (30)
- JavaScript (30)
- java (61)
- jQuery (3)
- ACE (2)
- oracle (9)
- jni (0)
- android (2)
- shell (1)
- myeclipse (1)
- Hibernate (1)
- linux (2)
- sqlserver (2)
- windows (2)
- sql (2)
- php (2)
- css (1)
- 学习 (1)
- ExtJs (1)
- RSS (1)
- 报文 (1)
- 跟我学Spring3 (6)
- dos (1)
- server (1)
- nosql (4)
- mongodb (6)
- photoshop (1)
- WebService (2)
- 股票 (1)
- OpenGL (3)
- Spring3MVC (6)
- 生活 (1)
- struts2 (1)
- 云盘 (1)
- blog (1)
- nosql nodejs mongoose (1)
最新评论
-
sblig:
配置分片: mongo -port 27017config ...
搭建Mongodb集群:分片Sharding+副本集Replica Set -
sblig:
配置路由:mongs: 40000 40100 40200sc ...
搭建Mongodb集群:分片Sharding+副本集Replica Set -
fuanyu:
哥们,干得漂亮。。
struts2 高危漏洞修复 -
sblig:
配置列子如下
<?xml version="1 ...
跟我学Spring3 学习笔记一 -
sblig:
307622798 写道博主你好,最近在看你的js系列文章,发 ...
JavaScript 学习笔记 二 对象的访问
工具类:
import java.io.BufferedReader; import java.io.ByteArrayOutputStream; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.File; import java.io.FileFilter; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.RandomAccessFile; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; import sun.net.TelnetInputStream; import sun.net.TelnetOutputStream; import sun.net.ftp.FtpClient; import sun.net.ftp.FtpLoginException; public class FtpUtil { /** * @param args */ public static void main(String[] args) { FtpUtil ftp = new FtpUtil(); ftp.connect("10.16.12.75", 21, "ftpusr", "ftpusr"); try { // 上传目录下文件 并可以递归到子目录 // ftp.upPathFile(new File("D:\\ALSC"), "ALSC/"); // 下载目录下多个文件 并可以递归到子目录 //ftp.downPathFile("/opt/ftp/outgoing/cs/", "D:/outgoing/csvc"); // 切换目录 ftp.setPath("/opt/ftp/book"); System.out.println(ftp.getDir()); for (String file : ftp.getFileNameList()) { System.out.println(file); } // 切换到父级目录 ftp.up(); // 创建多目录 // ftp.createDir("aa/bb/cc"); ftp.setPath("ftpTest"); // 删除文件 ftp.deleteFile("bbb.bmp"); System.out.println(ftp.getDir()); for (String file : ftp.getFileNameList()) { System.out.println(file); } // 上传 下载单个文件 ftp.uploadFile("c:/aaa.bmp", "bbb.bmp"); ftp.downloadFile("bbb.bmp", "c:/bbb"); List<String> list = ftp.getFileList(); for (String file : list) { System.out.println(file); } ftp.setPath("/opt/ftp/outgoing/cs"); String patternStr = "^CSGET_[0-9]{4}_0085_"+"20120926"+"_[0-9]{3}"; // 过滤,获取目录下的文件列表 list = ftp.getFileList(new CSFilter(patternStr)); for (String file : list) { System.out.println(file); } //下载 过滤后的文件 ftp.downPathFile("/opt/ftp/outgoing/cs/", "D:/outgoing/csvc",new CSFilter(patternStr)); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } ftp.close(); } private FtpClient ftpClient = null; /** * 打开连接 * * @param hostname * @param port * @param username * @param passwd * @return */ public void connect(String hostname, int port, String username, String passwd) { String msg = ""; try { ftpClient = new FtpClient(hostname, port); ftpClient.login(username, passwd); ftpClient.binary(); msg = "连接成功!"; } catch (FtpLoginException e) { msg = "登录主机失败,可能是用户名密码错误!"; e.printStackTrace(); } catch (IOException e) { msg = "登录主机失败,请检验端品是否正确!"; e.printStackTrace(); } catch (SecurityException e) { msg = "无权连接主机,主确认是否有权限连接主机!"; e.printStackTrace(); } System.out.println(msg); } /** * 关闭连接 */ public void close() { if (ftpClient == null) { return; } try { ftpClient.closeServer(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } /** * 重命名 * * @param oldName * @param newName * @return */ public boolean renameFile(String oldName, String newName) { boolean result = false; try { this.ftpClient.rename(oldName, newName); result = true; } catch (IOException e) { e.printStackTrace(); } return result; } /** * 取得相对于当前连接目录的某个目录下所有文件列表 * * @param path * @return */ public List getFileList(String path) { List list = new ArrayList(); DataInputStream dis; try { dis = new DataInputStream(ftpClient.nameList(this.getDir() + path)); String filename = ""; while ((filename = dis.readLine()) != null) { list.add(filename); } } catch (IOException e) { e.printStackTrace(); } return list; } /** * 读取文件列表 * * @return * @throws IOException */ public List<String> getFileList() throws IOException { List<String> fileList = new ArrayList<String>(); InputStreamReader isr = null; BufferedReader br = null; try { isr = new InputStreamReader(this.ftpClient.list()); br = new BufferedReader(isr); String fileName = ""; while (true) { fileName = br.readLine(); if (fileName == null) { break; } fileList.add(fileName); } } finally { if (br != null) { try { br.close(); } catch (IOException e) { e.printStackTrace(); } } if (isr != null) { try { isr.close(); } catch (IOException e) { e.printStackTrace(); } } } return fileList; } /** * 读取文件列表 * * @return * @throws IOException */ public List<String> getFileList(FileFilter filter) throws IOException { List<String> fileList = new ArrayList<String>(); InputStreamReader isr = null; BufferedReader br = null; try { isr = new InputStreamReader(this.ftpClient.list()); br = new BufferedReader(isr); String fileName = ""; while (true) { fileName = br.readLine(); if (fileName == null) { break; } if ((filter == null) || filter.accept(new File(fileName))) fileList.add(fileName); } } finally { if (br != null) { try { br.close(); } catch (IOException e) { e.printStackTrace(); } } if (isr != null) { try { isr.close(); } catch (IOException e) { e.printStackTrace(); } } } return fileList; } /** * 获取文件名列表 * * @return * @throws IOException */ public List<String> getFileNameList() throws IOException { List<String> fileNameList = new ArrayList<String>(); InputStreamReader isr = null; BufferedReader br = null; try { isr = new InputStreamReader(this.ftpClient.nameList(this.getDir())); br = new BufferedReader(isr); String fileName = ""; while (true) { fileName = br.readLine(); if (fileName == null) { break; } fileNameList.add(fileName); } } finally { if (br != null) { try { br.close(); } catch (IOException e) { e.printStackTrace(); } } if (isr != null) { try { isr.close(); } catch (IOException e) { e.printStackTrace(); } } } return fileNameList; } /** * 设置路径 切换目录 * * @param path * @return */ public boolean setPath(String path) { if (this.ftpClient != null) { try { ftpClient.cd(path); return true; } catch (IOException e) { e.printStackTrace(); return false; } } else { return false; } } /** * 判断是否为目录 * * @param line * @return */ public boolean isDir(String line) { return line.startsWith("d"); } /** * 检查文件夹在当前目录下是否存在 * * @param dir * @return */ public boolean isDirExist(String dir) { String pwd = ""; try { pwd = ftpClient.pwd(); ftpClient.cd(dir); ftpClient.cd(pwd); } catch (Exception e) { return false; } return true; } /** * 获取当前路径 * * @return * @throws IOException */ public String getDir() throws IOException { return this.ftpClient.pwd(); } /** * 向上 切换到父级目录 * * @throws IOException */ public void up() throws IOException { if ("/".equals(ftpClient.pwd()) || "//".equals(ftpClient.pwd())) { return; } this.ftpClient.cdUp(); } /** * 删除文件 * * @param fileName * @return */ public void deleteFile(String fileName) { ftpClient.sendServer("dele " + fileName + "\r\n");// 这个地方一定要注意 加上 \r\n try { if (ftpClient.readServerResponse() != 250) System.out.println("删除异常"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } /** * 在当前目录下创建文件夹 * * @param dir * @return * @throws Exception */ public boolean createDir(String dir) { try { ftpClient.ascii(); StringTokenizer s = new StringTokenizer(dir, "/"); // sign s.countTokens(); String pathName = ftpClient.pwd(); while (s.hasMoreElements()) { pathName = pathName + "/" + (String) s.nextElement(); try { ftpClient.sendServer("MKD " + pathName + "\r\n"); } catch (Exception e) { e = null; return false; } ftpClient.readServerResponse(); } ftpClient.binary(); return true; } catch (IOException e1) { e1.printStackTrace(); return false; } } /** * 上传文件 * * @param localFile * @param targetFileName * @return */ public boolean uploadFile(String localFile, String targetFileName) { boolean result = false; if (this.ftpClient == null) { return false; } TelnetOutputStream tos = null; RandomAccessFile sendFile = null; DataOutputStream dos = null; try { File file = new File(localFile); sendFile = new RandomAccessFile(file, "r"); sendFile.seek(0); tos = this.ftpClient.put(targetFileName); dos = new DataOutputStream(tos); int ch = 0; while (sendFile.getFilePointer() < sendFile.length()) { ch = sendFile.read(); dos.write(ch); } result = true; } catch (Exception ex) { result = false; } finally { if (tos != null) { try { tos.close(); } catch (IOException e) { e.printStackTrace(); } } if (dos != null) { try { dos.close(); } catch (IOException e) { e.printStackTrace(); } } if (sendFile != null) { try { sendFile.close(); } catch (IOException e) { e.printStackTrace(); } } } return result; } /** * 上传文件 * * @param localFile * @param targetFileName * @return */ public boolean uploadFile(File localFile, String targetFileName) { boolean result = false; if (this.ftpClient == null) { return false; } TelnetOutputStream tos = null; RandomAccessFile sendFile = null; DataOutputStream dos = null; try { sendFile = new RandomAccessFile(localFile, "r"); sendFile.seek(0); tos = this.ftpClient.put(targetFileName); dos = new DataOutputStream(tos); int ch = 0; while (sendFile.getFilePointer() < sendFile.length()) { ch = sendFile.read(); dos.write(ch); } result = true; } catch (Exception ex) { result = false; } finally { if (tos != null) { try { tos.close(); } catch (IOException e) { e.printStackTrace(); } } if (dos != null) { try { dos.close(); } catch (IOException e) { e.printStackTrace(); } } if (sendFile != null) { try { sendFile.close(); } catch (IOException e) { e.printStackTrace(); } } } return result; } /** * 上传本地目录下的所有文件到服务器上 * * @param srcPath * @param tagPath * @param level * 递归的级别 * @return * @see [类、类#方法、类#成员] */ public boolean upPathFile(File srcPathFile, String tagPath) { buildList(tagPath.substring(0, tagPath.lastIndexOf("/"))); boolean result = true; try { File temp[] = srcPathFile.listFiles(); for (int i = 0; i < temp.length; i++) { if (temp[i].isDirectory()) { if (tagPath.lastIndexOf('/') > 0) { result = upPathFile(temp[i], tagPath + temp[i].getName() + "/"); } else { result = upPathFile(temp[i], tagPath + "/" + temp[i].getName() + "/"); } } else { if (tagPath.lastIndexOf('/') > 0) { result = uploadFile(temp[i], tagPath + temp[i].getName()); } else { result = uploadFile(temp[i], tagPath + "/" + temp[i].getName()); } } } } catch (Exception e) { e.printStackTrace(); } return result; } /** * 下载文件 * * @param srcFileName * @param targetFileName * @return */ public boolean downloadFile(String srcFileName, String targetFileName) { if (this.ftpClient == null) { return false; } TelnetInputStream tis = null; RandomAccessFile getFile = null; boolean result = true; try { File file = new File(targetFileName); getFile = new RandomAccessFile(file, "rw"); getFile.seek(0); tis = this.ftpClient.get(srcFileName); DataInputStream dis = new DataInputStream(tis); int ch = 0; while (true) { ch = dis.read(); if (ch < 0) { break; } getFile.write(ch); } getFile.close(); } catch (IOException e) { result = false; } finally { if (getFile != null) { try { getFile.close(); } catch (IOException e) { e.printStackTrace(); } } if (tis != null) { try { tis.close(); } catch (IOException e) { e.printStackTrace(); } } } return result; } /** * 下载文件 * * @param srcFileName * @param targetFileName * @return */ public boolean downloadFile(String srcFileName, File targetFileName) { if (this.ftpClient == null) { return false; } TelnetInputStream tis = null; RandomAccessFile getFile = null; boolean result = true; try { getFile = new RandomAccessFile(targetFileName, "rw"); getFile.seek(0); tis = this.ftpClient.get(srcFileName); DataInputStream dis = new DataInputStream(tis); int ch = 0; while (true) { ch = dis.read(); if (ch < 0) { break; } getFile.write(ch); } getFile.close(); } catch (IOException e) { result = false; } finally { if (getFile != null) { try { getFile.close(); } catch (IOException e) { e.printStackTrace(); } } if (tis != null) { try { tis.close(); } catch (IOException e) { e.printStackTrace(); } } } return result; } /** * 下载远程目录下的所有文件到本地 * * @param srcPathFile * 远程目录文件 * @param tagPath * 本地存放目录 * @return * @throws IOException * @see [类、类#方法、类#成员] */ public boolean downPathFile(String srcPath, String tagPath) throws IOException { boolean result = true; File tagFile = new File(tagPath); tagFile.mkdirs(); setPath(srcPath); String tempPath = ""; List<String> list = getFileList(); for (int i = 0; i < list.size(); i++) { String currPath = list.get(i); String fileName = getFileName(currPath); String currPathFul = getDir() + "/" + fileName; if (tagPath.lastIndexOf('/') > 0) { tempPath = tagPath + currPathFul.substring(currPathFul.lastIndexOf("/"), currPathFul.length()); } else { tempPath = tagPath + "/" + currPathFul.substring(currPathFul.lastIndexOf("/"), currPathFul.length()); } if (isDir(currPath)) { srcPath = currPathFul + "/"; downPathFile(srcPath, tempPath); } else { srcPath = currPathFul; downloadFile(srcPath, tempPath); } } return result; } /** * 下载远程目录下的所有文件到本地,过滤规则 * * @param srcPathFile * 远程目录文件 * @param tagPath * 本地存放目录 * @param fileFilter * 下载过滤文件 * @return * @throws IOException * @see [类、类#方法、类#成员] */ public boolean downPathFile(String srcPath, String tagPath, FileFilter fileFilter) throws IOException { boolean result = true; File tagFile = new File(tagPath); tagFile.mkdirs(); setPath(srcPath); String tempPath = ""; List<String> list = getFileList(fileFilter); for (int i = 0; i < list.size(); i++) { String currPath = list.get(i); String fileName = getFileName(currPath); String currPathFul = getDir() + "/" + fileName; if (tagPath.lastIndexOf('/') > 0) { tempPath = tagPath + currPathFul.substring(currPathFul.lastIndexOf("/"), currPathFul.length()); } else { tempPath = tagPath + "/" + currPathFul.substring(currPathFul.lastIndexOf("/"), currPathFul.length()); } if (isDir(currPath)) { srcPath = currPathFul + "/"; downPathFile(srcPath, tempPath, fileFilter); } else { srcPath = currPathFul; downloadFile(srcPath, tempPath); } } return result; } public String getFileName(String line) { int i; String filename = (String) parseLine(line).get(8); for (i = 9; i < parseLine(line).size(); i++) { filename = filename + " " + ((String) parseLine(line).get(i)); } return filename; } // 处理getFileList取得的行信息 private ArrayList parseLine(String line) { ArrayList s1 = new ArrayList(); StringTokenizer st = new StringTokenizer(line, " "); while (st.hasMoreTokens()) { s1.add(st.nextToken()); } return s1; } /** * 从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; } /** * 上传文件到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服务器上建立指定的目录,当目录已经存在的情下不会影响目录下的文件,这样用以判断FTP * 上传文件时保证目录的存在目录格式必须以"/"根目录开头 * * @param pathList * String * @throws Exception */ public void buildList(String pathList) { try { 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(); pathName = pathName + "/"; } ftpClient.binary(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } }
过滤:
import java.io.File; import java.io.FileFilter; import java.util.ArrayList; import java.util.StringTokenizer; import java.util.regex.Pattern; public class CSFilter implements FileFilter { private String patternStr ; //"^CSGET_[0-9]{4}_0085_"+"20120926"+"_[0-9]{3}" private Pattern pattern ; public CSVCFilter(String str){ this.patternStr = str; this.pattern = Pattern.compile(patternStr); } public boolean accept(File pathname) { String strName = pathname.getName(); if (!isDir(strName)) { strName = getFileName(strName); System.out.println(strName); return pattern.matcher(strName).matches(); } return true; } public boolean isDir(String strName) { return ((String) parseLine(strName).get(0)).indexOf("d") != -1; } public String getFileName(String line) { int i; String filename = (String) parseLine(line).get(8); for (i = 9; i < parseLine(line).size(); i++) { filename = filename + " " + ((String) parseLine(line).get(i)); } return filename; } // 处理getFileList取得的行信息 private ArrayList parseLine(String line) { ArrayList s1 = new ArrayList(); StringTokenizer st = new StringTokenizer(line, " "); while (st.hasMoreTokens()) { s1.add(st.nextToken()); } return s1; } public String getFileSize(String line) { return (String) parseLine(line).get(4); } public String getFileDate(String line) { ArrayList a = parseLine(line); return (String) a.get(5) + " " + (String) a.get(6) + " " + (String) a.get(7); } }
下载速度提升
public boolean downloadFile(String srcFileName, File targetFileName) { //..... //下载速度太慢,用如下方式进行提升 byte[] recvbuf = new byte[1024]; while((ch = dis.read(recvbuf)) > 0){ getFile.write(recvbuf,0,ch); } // while (true) { // ch = dis.read(); // if (ch < 0) { // break; // } // getFile.write(ch); // } //... }
发表评论
-
[Java性能剖析]远程调试配置
2014-07-10 10:48 829一、服务器操作如下: 找到文件:apache-tomcat-5 ... -
[jdk工具命令]Java SE 文档
2014-07-10 10:43 790oracle java se documentation j ... -
[jdk命令工具]jconsole远程项目监控
2014-07-10 10:37 805入口:catalina.sh JAVA_OPTS=&quo ... -
[jvm参数]JVM简单配置
2014-07-10 10:35 1236-Xms256m -Xmx512M -XX:MaxPermSi ... -
struts2 高危漏洞修复
2013-07-23 10:30 12051. /** * 过滤器 */ ... -
转:调查服务器响应时间的利器 tcprstat
2012-11-16 13:50 1500http://rdc.taobao.com/blog/cs/? ... -
跟我学Spring3 学习笔记七 初始化与销毁
2012-10-18 16:45 2105最后 遗留一个问题, ... -
跟我学Spring3 学习笔记六 注入
2012-10-18 14:31 2252跟我学Spring3 学习笔 ... -
动态生成class
2012-10-16 11:17 1386ASM 进行动态生成class import org.obj ... -
java 高性能网络编程 NIO
2012-09-28 16:31 1536服务器端: // 1. 分配一个 Serve ... -
java 高性能网络编程 mina
2012-09-28 10:52 1706服务器端: // 创建一个非阻塞的server端so ... -
代理 下载网页,挖掘数据
2012-09-25 13:51 911URL url = new URL("http:// ... -
java nio 编程学习 一
2012-09-21 16:08 1189Java.nio中的主要类ServerSocketChanne ... -
MongoDB 实战笔记 四
2012-09-20 14:12 1163import java.net.UnknownHostExce ... -
Json 添加元素拼接JSON字符串(转)
2012-09-20 13:55 7071package com.util; import jav ... -
MongoDB 实战笔记 三
2012-09-20 13:37 2500导出mongoexport -d m ... -
MongoDB 实战笔记 二
2012-09-20 11:45 949MongoDB 实战笔记 count 查询记录 ... -
MongoDB 实战笔记 一
2012-09-20 11:30 1194MongoDB 实战笔记 来建立一个 test 的集 ... -
Struts 学习笔记 二
2012-09-17 16:56 899login.jsp 登陆页面 <html:form ac ... -
Struts 学习笔记 一
2012-09-14 15:36 1165struts 1.2 涉及到的包: commons-b ...
相关推荐
在实际应用开发中,实现这样的FTP工具通常会涉及到以下几个关键知识点: - **FTP协议**:理解FTP的工作原理,包括命令结构、连接模式(如主动和被动模式)以及身份验证机制。 - **Android权限**:在Android系统中...
FTP(File Transfer Protocol)是一种用于在网络上进行文件传输的标准协议,广泛应用于各种系统中,包括Java。...同时,编写健壮的FTP工具类时,需要充分考虑异常情况,以确保文件传输的稳定性和可靠性。
总的来说,"FTP下载类 支持续传"是C#开发中一个实用的工具,它优化了FTP下载体验,通过修复已知问题和增加新功能,为开发者提供了更强大的FTP客户端解决方案。对于需要进行FTP文件操作的项目来说,这是一个值得参考...
在这个场景中,我们看到的"Java FTP文件上传下载"是一个具体的实现,它可能包含了一个自定义的工具类`FtpUtil.java`,以及一些依赖的库文件。 `FtpUtil.java`很可能是一个封装了FTP操作的类,包括连接FTP服务器、...
首先,我们需要引入Java的FTP客户端库,通常使用`org.apache.commons.net.ftp`包中的`FTPClient`类。Apache Commons Net是Apache软件基金会提供的一组网络协议实用工具,包括对FTP协议的支持。 1. **连接FTP服务器*...
Java实现上传和下载工具类是指使用Java语言实现的文件上传和下载功能,通过使用FTP(File Transfer Protocol)协议将文件上传到FTP服务器或从FTP服务器下载文件。下面将详细介绍Java实现上传和下载工具类的知识点。...
`FtpUtil.java`这个文件名表明可能存在一个处理FTP(文件传输协议)的工具类。FTP是互联网上标准的数据传输协议,用于在不同主机之间上传、下载文件。结合MQ,可能是实现了通过FTP传输消息队列中的数据,例如日志...