这是我使用的代码。
public void Listing(String filename)
{
header = new ArrayList<String>();
int fid = 0;
int hid = 0;
BufferedReader bufferedReader = null;
InputStream inputStream = null;
setFtpUrl();
String fullPath = setFullPath();
try
{
URL url = new URL(fullPath);
URLConnection conn = url.openConnection();
inputStream = conn.getInputStream();
bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
String line = bufferedReader.readLine();
Boolean isHeader = true;
while (line != null)
{
Rlines = new ArrayList<String>();
int k=0;
while(k<300 && line!=null){
if (isHeader){
header = Arrays.asList(line);
hjson = new Gson().toJson(header);
hid = dbConnect.insertHeader(hjson);
isHeader=false;
fid = dbConnect.insertFile(filename, "ss", 0, 0, 0, hid);
}
else{
List<String> rows = Arrays.asList(line);
rjson = new Gson().toJson(rows);
Rlines.add(rjson.toString());
}
line = bufferedReader.readLine();
k++;
}
dbConnect.insertRows(Rlines, "New", fid, hid, "123kot123");
}
}
您是否遇到过与普通的FTP GUI客户端(例如WinSCP或FilezZlla)相同的问题? –
不,当我使用普通的FTP客户端(我使用FileZilla)时,我没有同样的问题,并且速度更快(使用我的FTP客户端的速度要快10倍或更多)。这对我来说很奇怪,因为它是相同的代码! 这是我的代码或别的什么问题? –
向我们显示您的代码。 –