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);
// create FileEntry object
JSONObject entry = new JSONObject();
FileUtils fileUtil = new FileUtils();
entry.put("isFile", file.isFile());
entry.put("isDirectory", file.isDirectory());
entry.put("name", file.getName());
entry.put("fullPath", file.getAbsolutePath());
return entry;
return fileUtil.getEntry(file);
} catch (Exception e) {
Log.d(LOG_TAG, e.getMessage(), e);
throw new IOException("Error while downloading");

View File

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