-1

Help!! i have installed ApacheCommons.net FTPClient. As i need to download a PNG file via ftp. The stream downloads but iam having trouble converting it into a Bitmap so i can save to local storage.

        mFTPClient.connect("path");
        mFTPClient.login("anonymous","nobody");
        mFTPClient.enterLocalPassiveMode();
        mFTPClient.changeWorkingDirectory("/fax");
        InputStream inStream = mFTPClient.retrieveFileStream("nweimage.PNG");
        InputStreamReader isr = new InputStreamReader(inStream, "UTF8"); 

Been trying to use BitmapFactory to convert it, but just keep getting null return.

Any pointers

Cheers

1 Answers1

0

This is how i got around it. Thanks greenapps for making me think down a different route

     mFTPClient.connect("path");
        mFTPClient.login("anonymous","nobody");
        mFTPClient.enterLocalPassiveMode();
        mFTPClient.changeWorkingDirectory("/fax");
        mFTPClient.setControlEncoding("UTF-8");
        mFTPClient.setFileType(FTPClient.BINARY_FILE_TYPE);
    try{
            FileOutputStream out = new FileOutputStream(file);

            boolean status = mFTPClient.retrieveFile("image.PNG", out);
            out.flush();
            out.close();

        } catch (Exception e) {
            e.printStackTrace();
        }