導航:首頁 > 編程語言 > javaftp緩沖下載

javaftp緩沖下載

發布時間:2023-02-08 08:37:39

❶ 我在用java寫FTP下載的時候出現這個問題

估計是C:\Documents and Settings\Administrator\Application Data\這個文件夾的問題,應該是windows系統指定用來存放某些文件的目錄。那你就不要非得放在這個目錄好了,不要在一棵樹上弔死。

❷ 看了一段java代碼是從FTP上下載文件,ftpClient.setBufferSize()這個是什麼用處,要怎麼使用它

設置每次讀取文件流時緩存數組的大小。上傳或者下載都是先將文件流拿到,然專後將文件流一屬點一點的讀到緩存,然後程序在從緩存將所需的內容讀取出來放進要導入的文件中。
一般情況下基本都是1024或者是1024的倍數。對於小文件上傳下載的話沒有必要管,直接1024就沒有問題。

❸ 實現 java ftp下載功能 for (FTPFile ff : fs) 為空,求大蝦幫我看下,

不大可能。。
除非字典法套出有許可權的用戶名和密碼

人家只給了你LIST的許可權,你沒有下載許可權。

❹ 用java實現ftp下載,路徑的問題,很暈

ftpClient.changeWorkingDirectory(」20110814「),你應該這么寫,如果用/開頭表示是絕對路徑,而 20110814表示是相對路徑,你看下絕對路徑跟相對路徑就明白了

❺ java 下載異地FTP中的zip文件

好像需要一個支持jar包把,把ftp4j的下載地址貼出來

❻ 用java完成文件ftp上傳下載

使用rt.jar中的sun.net.FtpClient類來實現對FTP伺服器的文件上傳下載

❼ java從FTP上下載文件大小大概10M左右,ftpClient.setBufferSize(1024)要設置多大的呢

幾k到1m 這個是臨時的緩沖

❽ 如何在Java程序中實現FTP的上傳下載功能

以下是這三部分的JAVA源程序: (1)顯示FTP伺服器上的文件 void ftpList_actionPerformed(ActionEvent e) {String server=serverEdit.getText();//輸入的FTP伺服器的IP地址 String user=userEdit.getText();//登錄FTP伺服器的用戶名 String password=passwordEdit.getText();//登錄FTP伺服器的用戶名的口令 String path=pathEdit.getText();//FTP伺服器上的路徑 try {FtpClient ftpClient=new FtpClient();//創建FtpClient對象 ftpClient.openServer(server);//連接FTP伺服器 ftpClient.login(user, password);//登錄FTP伺服器 if (path.length()!=0) ftpClient.cd(path); TelnetInputStream is=ftpClient.list(); int c; while ((c=is.read())!=-1) { System.out.print((char) c);} is.close(); ftpClient.closeServer();//退出FTP伺服器 } catch (IOException ex) {;} } (2)從FTP伺服器上下傳一個文件 void getButton_actionPerformed(ActionEvent e) { String server=serverEdit.getText(); String user=userEdit.getText(); String password=passwordEdit.getText(); String path=pathEdit.getText(); String filename=filenameEdit.getText(); try { FtpClient ftpClient=new FtpClient(); ftpClient.openServer(server); ftpClient.login(user, password); if (path.length()!=0) ftpClient.cd(path); ftpClient.binary(); TelnetInputStream is=ftpClient.get(filename); File file_out=new File(filename); FileOutputStream os=new FileOutputStream(file_out); byte[] bytes=new byte[1024]; int c; while ((c=is.read(bytes))!=-1) { os.write(bytes,0,c); } is.close(); os.close(); ftpClient.closeServer(); } catch (IOException ex) {;} } (3)向FTP伺服器上上傳一個文件 void putButton_actionPerformed(ActionEvent e) { String server=serverEdit.getText(); String user=userEdit.getText(); String password=passwordEdit.getText(); String path=pathEdit.getText(); String filename=filenameEdit.getText(); try { FtpClient ftpClient=new FtpClient(); ftpClient.openServer(server); ftpClient.login(user, password); if (path.length()!=0) ftpClient.cd(path); ftpClient.binary(); TelnetOutputStream os=ftpClient.put(filename); File file_in=new File(filename); FileInputStream is=new FileInputStream(file_in); byte[] bytes=new byte[1024]; int c; while ((c=is.read(bytes))!=-1){ os.write(bytes,0,c);} is.close(); os.close(); ftpClient.closeServer(); } catch (IOException ex) {;} } }

❾ 請教Java Jsp中Ftp文件下載問題

<%@ page contentType="text/html; charset=GBK"%>
<%@ page language="java" import="java.io.IOException" pageEncoding="GBK"%>
<%@ page import="com.enterprisedt.net.ftp.FTPClient"%>
<%@ page import="com.enterprisedt.net.ftp.FTPTransferType"%>
<%@ page import="java.io.*,com.enterprisedt.net.ftp.FTPConnectMode;"%>

<html>
<head>
<title>主頁面</title>
</head>
<body>
<%
String path = null;
String filename = null;

path = request.getParameter("path");
filename = request.getParameter("filename");
//response.setContentType("application/unknown");//設置為下載application/x-download

//其中%20是空格在UTF-8下的編碼
//filename = URLEncoder.encode(filename, "UTF-8");
//filename = new String(filename.getBytes("gb2312"),"ISO8859-1");

//response.setHeader("Content-Disposition", "attachment; filename=\"" + filename + "\";");
String host = "192.168.12.49";
String users = "admin";
String passwords = "admin";

if (path.trim().length() > 1) {
path = path.trim() + "/";
}
String remoteFile = path + filename; //確定源文件的位置
String downFile = "d:/" + filename; //確定源文件的位置
System.out.println(remoteFile + " 正在下載中,請稍等................");
try {
OutputStream outputStream = response.getOutputStream();
FTPClient client = new FTPClient();
client.setRemoteHost(host);
//client.setDetectTransferMode(true);
client.connect();
client.login(users, passwords);
client.setConnectMode(FTPConnectMode.ACTIVE);
client.setType(FTPTransferType.BINARY);
//client.get(outputStream, remoteFile); //*方式一:將ftp上的文件取出後,寫入到response(outputStream),以response把文件帶到瀏覽器,由瀏覽器來提示用戶是否願意保存文件到本
//*一直存在中文文件名沒有解決的問題
client.get(downFile, remoteFile); //*方式二:將FTP上文件取出後,直接下載到D盤下
outputStream.close();
client.quit();
} catch (IOException e) {
e.printStackTrace();
}
%>
</body>
</html>

❿ java FTP下載

FTPClient ftp = new FTPClient()
ftp.configure(new FTPClientConfig(FTPClientConfig.SYST_UNIX));

Try setting an FTPCientConfig that matches your system.

閱讀全文

與javaftp緩沖下載相關的資料

熱點內容
asp找回密碼 瀏覽:836
如何知道別人使用我的電腦和看了什麼文件 瀏覽:712
prcs4視頻導出後找不到文件 瀏覽:977
msp430系列單片機實用c語言程序設計 瀏覽:423
移動硬碟的文件格式 瀏覽:904
文件本地路徑與雲路徑 瀏覽:103
進大白菜找不到系統文件 瀏覽:380
ug裝配體找不到文件部件已刪除 瀏覽:629
小網站怎麼弄出來 瀏覽:649
jsp表單加參數 瀏覽:607
蘋果5s手機老是卡屏 瀏覽:58
js給php變數賦值 瀏覽:446
雜志版本號是什麼意思 瀏覽:223
地圖特效代碼 瀏覽:192
去除思科配置文件中的號 瀏覽:196
運行的16位程序太多 瀏覽:1
蘋果mac用什麼軟體好學編程 瀏覽:681
ai中線段怎麼添加寬度配置文件 瀏覽:956
lol文件怎麼找不到game 瀏覽:142
aecc視頻教程 瀏覽:983

友情鏈接