为什么我从ftp读取下载到本地的文件始终只有15k,实际文件有100k,URLConnection.getInputStream的用法。
byte[] l_bt=new byte[900000];
String l_strURL=FtpSingleton.getInstance().getURL();
l_strURL+=strFileName+";type=i";
URL url = new URL(l_strURL);
URLConnection urlc = url.openConnection();
InputStream is = urlc.getInputStream(); // To download
FileManage.delete(Config.getInstance().getFtpPath()+strFileName);
File tfile = new File(Config.getInstance().getFtpPath()+strFileName);
RandomAccessFile rdtfile = new RandomAccessFile(tfile, "rw");
int l_iNum=is.read(l_bt);
rdtfile.write(l_bt,0,l_iNum);
System.out.println("local bankunion file " + String.valueOf(rdtfile.length()));
rdtfile.close();
is.close();
l_bRet=true;
上面这段代码是我从ftp上读取文件到本地,每次读下来只有15k。为什么啦,写法有问题吗?