public NetResponse pullFile( String strUrl, String strFileName, IRhoSession oSession, Hashtable headers) throws Exception { IRAFile file = null; NetResponse resp = null; m_nMaxPacketSize = RhoClassFactory.getNetworkAccess().getMaxPacketSize(); m_bFlushFileAfterWrite = RhoConf.getInstance().getBool("use_persistent_storage"); m_bCancel = false; try { if (!strFileName.startsWith("file:")) { try { strFileName = FilePath.join(RhoClassFactory.createFile().getDirPath(""), strFileName); } catch (IOException x) { LOG.ERROR("getDirPath failed.", x); throw x; } } file = RhoClassFactory.createFSRAFile(); file.open(strFileName, "rw"); file.seek(file.size()); do { resp = pullFile1(strUrl, file, file.size(), oSession, headers); } while (!m_bCancel && (resp == null || resp.isOK()) && m_nCurDownloadSize > 0 && m_nMaxPacketSize > 0); } finally { if (file != null) { file.close(); file = null; } } copyHashtable(m_OutHeaders, headers); return resp != null && !m_bCancel ? resp : makeResponse("", IHttpConnection.HTTP_INTERNAL_ERROR); }