You should use the retrieveFilestream method instead of the retriveFile method.
FTPClient ftp = new FTPClient(); // configuration code for ftpclient port, server etc InputStream in = ftp.getretrieveFileStream("remoteFileName"); BufferedInputStream inbf = new BufferedInputStream(in); byte buffer[] = new byte[1024]; int readCount; byte result[] = null; int length = 0; while( (readCount = inbf.read(buffer)) > 0) { int preLength = length; length += readCount; byte temp[] = new byte[result.length]; result = new byte[length]; System.arraycopy(temp,0,result,0,temp.length); System.arraycopy(buffer,0,result,preLength,readCount); } return result;
Gursel koca
source share