How to retrieve Wid file for a Web Intelligence document

public static boolean downloadWid(IInfoObject infoObject, String filename)
       throws SDKException
{
    if (infoObject.getKind() != "Webi")
        return false;
    IFiles files = infoObject.getFiles();
    IRemoteFile file = (IRemoteFile) files.get(0);
    file.download(filename);
    file.commit();
    return true;
}