FtpClient client =Newftpclient (); Client.connect (Creditdata_ftp_ip, Creditdata_ftp_port); Client.login (Ftp_username, FTP_PASSWORD); Client.changeworkingdirectory ("/Out"); Client.enterlocalpassivemode (); //turn on local passive modeClient.setfiletype (Ftpclient.binary_file_type);//set the transfer mode to binaryClient.configure (NewFtpclientconfig ("UNIX"));//Set the Unix timestamp parsing methodClient.setcontrolencoding ("UTF-8"); Stream=NewGzipinputstream (Client.retrievefilestream (FileName)); Aistream=NewArchivestreamfactory (). Createarchiveinputstream ("Tar", stream); Tararchiveentry entry=NULL; while((Entry = (tararchiveentry) aistream.getnextentry ())! =NULL){ if(Entry.getname (). EndsWith ("/")) {//Skip Directory Continue; }Reader=NewBufferedReader (NewInputStreamReader (Aistream, "UTF-8")); String Line=NULL; while(line = Reader.readline ())! =NULL) {ParseLine (line);
}
}
Java reads the GZ file on the FTP server