当前位置: 首页>>代码示例>>Java>>正文


Java Entry类代码示例

本文整理汇总了Java中com.dropbox.client2.DropboxAPI.Entry的典型用法代码示例。如果您正苦于以下问题:Java Entry类的具体用法?Java Entry怎么用?Java Entry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Entry类属于com.dropbox.client2.DropboxAPI包,在下文中一共展示了Entry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createFile

import com.dropbox.client2.DropboxAPI.Entry; //导入依赖的package包/类
public EncFSFileInfo createFile(String path) throws IOException {
	Entry entry;

	try {
		entry = api.putFileOverwrite(getAbsolutePath(path), new FileInputStream(
				"/dev/zero"), 0, null);
	} catch (DropboxException e) {
		handleDropboxException(e);
		return null;
	}

	if (entry != null) {
		return entryToFileInfo(entry);
	}

	return null;
}
 
开发者ID:starn,项目名称:encdroidMC,代码行数:18,代码来源:FileProvider4.java

示例2: fsList

import com.dropbox.client2.DropboxAPI.Entry; //导入依赖的package包/类
public List<EncFSFileInfo> fsList(String path) throws IOException {
	try {
		List<EncFSFileInfo> list = new ArrayList<EncFSFileInfo>();

		Entry dirEnt = api.metadata(getAbsolutePath(path), 0, null, true, null);

		if (!dirEnt.isDir) {
			IOException ioe = new IOException(path + " is not a directory");
			throw ioe;
		}

		// Add entries to list
		for (Entry childEnt : dirEnt.contents) {
			list.add(entryToFileInfo(childEnt));
		}

		return list;
	} catch (DropboxException e) {
		handleDropboxException(e);
		return null;
	}
}
 
开发者ID:starn,项目名称:encdroidMC,代码行数:23,代码来源:FileProvider4.java

示例3: doInBackground

import com.dropbox.client2.DropboxAPI.Entry; //导入依赖的package包/类
@Override
protected List<Entry> doInBackground(Object... params) { //TODO: error handling!!!
    Entry someFiles = null;
    try {
        someFiles = LibraryActivity.this.mApi
                .metadata((mLimiter == null ? "/" : (String) mLimiter.data), 0, null, true,
                        null);
    } catch (DropboxException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    List<Entry> sortingBuffer = someFiles.contents;
    Collections.sort(someFiles.contents, new Comparator<Entry>() {
        @Override
        public int compare(Entry lhs, Entry rhs) {
            if (lhs.isDir && !rhs.isDir) {
                return -1;
            } else if (!lhs.isDir && rhs.isDir) {
                return 1;
            } else {
                return lhs.fileName().compareToIgnoreCase(rhs.fileName());
            }
        }
    });
    return sortingBuffer;
}
 
开发者ID:owoc,项目名称:teardrop,代码行数:27,代码来源:LibraryActivity.java

示例4: treeDir

import com.dropbox.client2.DropboxAPI.Entry; //导入依赖的package包/类
/**
        * Construct the tree, using pre-order recursive traversal.
        * @param node The Entry node used to start the traversal.
        * @return The constructed DBNode.
        */
       public DBNode treeDir(Entry node) {
	if (node == null)
		node = updateTree(node);
	else if (node.isDir)
		node = updateTree(node);
	System.out.println(node.fileName());
               //
               DBNode n = new DBNode(node);
               //File ret = downloadFile(node);
               //if (ret != null) {
                   //this.monitor.addFile(ret, node);
               //}
	if(node.contents == null)
		return n;
	for (Entry e : node.contents) {
		//TODO construct tree for Bill
		//System.out.print("\t");
		n.add(treeDir(e));
	}
               return n;
}
 
开发者ID:kevincon,项目名称:lightningrod,代码行数:27,代码来源:DBApi.java

示例5: updateTree

import com.dropbox.client2.DropboxAPI.Entry; //导入依赖的package包/类
/**
        * Update tree from node's perspective (just one level of children).
        * @param node Entry node to update.
        * @return The updated Entry node, otherwise null.
        */
       public Entry updateTree(Entry node) {
	String path;
	if (node == null) {
		path = "/";
	} else {
		path = node.path;
		System.out.println(path);
	}
	try {
		return mDBApi.metadata(path, 0, null, true, null);
	} catch (DropboxException ex) {
		Logger.getLogger(DBApi.class.getName()).log(Level.SEVERE, null, ex);
		return null;
	}
}
 
开发者ID:kevincon,项目名称:lightningrod,代码行数:21,代码来源:DBApi.java

示例6: sync

import com.dropbox.client2.DropboxAPI.Entry; //导入依赖的package包/类
@Background
void sync() {

	if (!cb.hasInternetConnection()) {
		scheduleNext();
	}

	Entry folderEntry = getRemoteFolderContent();

	if (folderEntry == null || mRemoteFolderUnchanged == true) {
		scheduleNext();
		return;
	}

	cleanUpLocalFiles(folderEntry);
	updateLocalFiles(folderEntry);
}
 
开发者ID:ironjan,项目名称:photodrop,代码行数:18,代码来源:DownSync.java

示例7: entryToFileInfo

import com.dropbox.client2.DropboxAPI.Entry; //导入依赖的package包/类
private EncFSFileInfo entryToFileInfo(Entry entry) {
	String relativePath = getRelativePathFromAbsolutePath(entry.parentPath());

	return new EncFSFileInfo(entry.fileName(), relativePath, entry.isDir,
			RESTUtility.parseDate(entry.modified).getTime(), entry.bytes,
			true, true, true);
}
 
开发者ID:starn,项目名称:encdroidMC,代码行数:8,代码来源:FileProvider4.java

示例8: getFileInfo

import com.dropbox.client2.DropboxAPI.Entry; //导入依赖的package包/类
public EncFSFileInfo getFileInfo(String path) throws IOException {
	try {
		Entry entry = api.metadata(getAbsolutePath(path), 1, null, false, null);

		if (entry != null) {
			return entryToFileInfo(entry);
		}

		return null;
	} catch (DropboxException e) {
		handleDropboxException(e);
		return null;
	}
}
 
开发者ID:starn,项目名称:encdroidMC,代码行数:15,代码来源:FileProvider4.java

示例9: isDirectory

import com.dropbox.client2.DropboxAPI.Entry; //导入依赖的package包/类
public boolean isDirectory(String path) throws IOException {
	try {
		Entry entry = api.metadata(getAbsolutePath(path), 1, null, false, null);
		return entry.isDir;
	} catch (DropboxException e) {
		handleDropboxException(e);
		return false;
	}
}
 
开发者ID:starn,项目名称:encdroidMC,代码行数:10,代码来源:FileProvider4.java

示例10: onPostExecute

import com.dropbox.client2.DropboxAPI.Entry; //导入依赖的package包/类
@Override
protected void onPostExecute(List<Entry> result) {
    mPagerAdapter.mDropboxAdapter.setLimiter(mLimiter);
    mPagerAdapter.mDropboxAdapter.commitQuery(result);
    updateLimiterViews();
    unlockDropboxFileBrowser();
}
 
开发者ID:owoc,项目名称:teardrop,代码行数:8,代码来源:LibraryActivity.java

示例11: commitQuery

import com.dropbox.client2.DropboxAPI.Entry; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void commitQuery(Object data) {
    if (data == null) {
        return;
    }
    mDropboxFiles = (ArrayList<Entry>) data;
    notifyDataSetInvalidated();
}
 
开发者ID:owoc,项目名称:teardrop,代码行数:10,代码来源:DropboxAdapter.java

示例12: createData

import com.dropbox.client2.DropboxAPI.Entry; //导入依赖的package包/类
@Override
public Intent createData(View row) {
    Intent intent = new Intent();
    intent.putExtra(LibraryAdapter.DATA_TYPE, MediaUtils.TYPE_DROPBOX);
    if (!mLinkedWithDropbox) {

        intent.putExtra(LibraryAdapter.DATA_LINK_WITH_DROPBOX, true);

        return intent;
    } else {

        ViewHolder holder = (ViewHolder) row.getTag();

        if (holder.id ==
                FileSystemAdapter.ID_LINK_TO_PARENT_DIR) { //the id for parent directory links
            Intent intent1 = new Intent();
            intent1.putExtra(LibraryAdapter.DATA_GO_UP, true);

            return intent1;
        }

        Entry dbFile = mDropboxFiles.get(holder.id);

        intent.putExtra(LibraryAdapter.DATA_TYPE, MediaUtils.TYPE_DROPBOX);
        intent.putExtra(LibraryAdapter.DATA_ID, (long) holder.id);
        intent.putExtra(LibraryAdapter.DATA_TITLE, holder.text.getText().toString());
        intent.putExtra(LibraryAdapter.DATA_EXPANDABLE, dbFile.isDir);

        String path;
        path = dbFile.path;

        intent.putExtra(LibraryAdapter.DATA_FILE, path);
        return intent;

    }
}
 
开发者ID:owoc,项目名称:teardrop,代码行数:37,代码来源:DropboxAdapter.java

示例13: listAllEbooks

import com.dropbox.client2.DropboxAPI.Entry; //导入依赖的package包/类
/**
 * Find all .epub files existing in current Dropbox Account
 */
@Override public Observable<Ebook> listAllEbooks() {

  return Observable.create(new Observable.OnSubscribe<DeltaEntry<Entry>>() {
    @Override public void call(Subscriber<? super DeltaEntry<Entry>> subscriber) {

      // restore Dropbox authentication info
      if (dropboxAPI == null) {
        AndroidAuthSession session = buildSession();
        dropboxAPI = new DropboxAPI<>(session);
      }

      try {
        boolean hasMore = true;
        String cursor = null;

        while (hasMore) {
          DeltaPage<Entry> result = dropboxAPI.delta(cursor);
          cursor = result.cursor;
          hasMore = result.hasMore;

          for (DeltaEntry<Entry> entry : result.entries) {
            subscriber.onNext(entry);
          }
        }
        subscriber.onCompleted();
      } catch (DropboxException e) {
        Log.e("DEBUG", "error getting delta from dropbox");
        subscriber.onError(new DropboxBookException());
      }
    }
  })
      //remove not .epub files
      .filter(new IsEpubFilter())
      //transform dropbox files to ebook files
      .map(new EbookDataMapper(dropboxAPI))
      //remove null ebooks
      .filter(new NotNullFilter<Ebook>());
}
 
开发者ID:carlosmuvi,项目名称:clean-ebook-library,代码行数:42,代码来源:DropboxDatasource.java

示例14: getFileInfo

import com.dropbox.client2.DropboxAPI.Entry; //导入依赖的package包/类
/**
 * Returns the file information in form of a dropbox Entry class.
 *
 * @param path Path to file or folder
 * @return Entry
 */
public Entry getFileInfo(String path) {
	try {
		return mDBApi.metadata(path, 25000, null, true, null);
	} catch (DropboxException e) {
		e.printStackTrace();
		return null;
	}
}
 
开发者ID:Rohde-Schwarz-Cybersecurity,项目名称:PanBox,代码行数:15,代码来源:DropboxConnector.java

示例15: store

import com.dropbox.client2.DropboxAPI.Entry; //导入依赖的package包/类
private void store(Entry entry, File localDir) throws DropboxException, IOException {
  Log.d("michael", "store " + entry.path);

  File file = new File(localDir, entry.fileName());

  if (entry.isDir) {
    Log.d("michael", "store dir " + entry.path);
    file.mkdirs();
    for (Entry ent : entry.contents) {
      Entry sub = mApi.metadata(ent.path, 1000, null, true, null);
      store(sub, file);
    }
  } else {
    OutputStream out = null;
    File successFile = getSuccessFile(file);
    if (successFile.exists()) {
      successFile.delete();
    }

    try {
      out = new BufferedOutputStream(new FileOutputStream(file));
      mApi.getFile(entry.path, null, out, null);
      Log.d("michael",
          "downloaded " + entry.path + " to " + file.getAbsolutePath());
    } finally {
      if (out != null) {
        try {
          out.close();
        } catch (IOException e) {
          // ignore
        }
      }
    }
  }
}
 
开发者ID:LiteracyBridge,项目名称:software,代码行数:36,代码来源:IOHandler.java


注:本文中的com.dropbox.client2.DropboxAPI.Entry类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。