made getEntry of FileUtils public in order to avoid duplicate code in FileTransfer

This commit is contained in:
Alexander Keller 2011-11-29 09:38:39 +01:00
parent 75963c88d5
commit 8dbb8f58b1
2 changed files with 843 additions and 848 deletions

View File

@ -405,14 +405,9 @@ public class FileTransfer extends Plugin {
Log.d(LOG_TAG, "Saved file: " + filePath); Log.d(LOG_TAG, "Saved file: " + filePath);
// create FileEntry object // create FileEntry object
JSONObject entry = new JSONObject(); FileUtils fileUtil = new FileUtils();
entry.put("isFile", file.isFile()); return fileUtil.getEntry(file);
entry.put("isDirectory", file.isDirectory());
entry.put("name", file.getName());
entry.put("fullPath", file.getAbsolutePath());
return entry;
} catch (Exception e) { } catch (Exception e) {
Log.d(LOG_TAG, e.getMessage(), e); Log.d(LOG_TAG, e.getMessage(), e);
throw new IOException("Error while downloading"); throw new IOException("Error while downloading");

View File

@ -838,7 +838,7 @@ public class FileUtils extends Plugin {
* @return * @return
* @throws JSONException * @throws JSONException
*/ */
private JSONObject getEntry(File file) throws JSONException { public JSONObject getEntry(File file) throws JSONException {
JSONObject entry = new JSONObject(); JSONObject entry = new JSONObject();
entry.put("isFile", file.isFile()); entry.put("isFile", file.isFile());