2
Dropbox에서 작업 중입니다. 나는 문서를 본다. 이 목록에 표시 내 코드입니다 :Dropbox에서 모든 유형의 파일 다운로드
Entry entryCheck = mApi.metadata("/", 100, null, true, null);
Log.i("Item Name", entryCheck.fileName());
Log.i("Is Folder", String.valueOf(entryCheck.isDir));
내가 보관의 모든 목록을 가지고 있지만, 내 질문은 파일이나 디렉토리가 어떻게 경우 여기
- 이 entryCheck.isDir 항상 나에게 진정한 가치를 제공한다는 것입니다 내가 어떤 파일인지 또는 어느 것이 디렉토리인지 알 수 있습니까?
- 어떻게 파일을 다운로드 했습니까?
이걸로 시도했지만 작동하지 않습니다 :
private boolean downloadDropboxFile(String dbPath, File localFile,
DropboxAPI<?> api) throws IOException {
BufferedInputStream br = null;
BufferedOutputStream bw = null;
try {
if (!localFile.exists()) {
localFile.createNewFile(); // otherwise dropbox client will fail
// silently
}
DropboxInputStream fin = mApi.getFileStream("dropbox", dbPath);
br = new BufferedInputStream(fin);
bw = new BufferedOutputStream(new FileOutputStream(localFile));
byte[] buffer = new byte[4096];
int read;
while (true) {
read = br.read(buffer);
if (read <= 0) {
break;
}
bw.write(buffer, 0, read);
}
} catch (DropboxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
// in finally block:
if (bw != null) {
bw.close();
}
if (br != null) {
br.close();
}
}
return true;
}