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


Java DropboxException.printStackTrace方法代码示例

本文整理汇总了Java中com.dropbox.client2.exception.DropboxException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java DropboxException.printStackTrace方法的具体用法?Java DropboxException.printStackTrace怎么用?Java DropboxException.printStackTrace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.dropbox.client2.exception.DropboxException的用法示例。


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

示例1: initialize

import com.dropbox.client2.exception.DropboxException; //导入方法依赖的package包/类
private void initialize(String token) {
    LogUtil.log(getClass().getSimpleName(), "initialize()");

    AppKeyPair appKeys = new AppKeyPair(APP_KEY, APP_SECRET);
    AndroidAuthSession session = new AndroidAuthSession(appKeys, ACCESS_TYPE);

    mDBApi = new DropboxAPI<>(session);

    if ( token == null )
        token = Settings.getDropboxSyncToken();

    if ( token != null )
        mDBApi.getSession().setOAuth2AccessToken(token);

    if (!doesFolderExist(getBaseFilePath())) {
        try {
            createFileStructure();
        } catch (DropboxException e) {
            e.printStackTrace();
        }
    }
}
 
开发者ID:timothymiko,项目名称:narrate-android,代码行数:23,代码来源:DropboxSyncService.java

示例2: doInBackground

import com.dropbox.client2.exception.DropboxException; //导入方法依赖的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

示例3: getFilesInDir

import com.dropbox.client2.exception.DropboxException; //导入方法依赖的package包/类
public Set<String> getFilesInDir(String dirName, String query)
{
    Set<String> retVal = null;

    if( isConnected() ) {
        try {
            Log.d(TAG, "Getting files in: " + dirName);

            DropboxAPI.Entry entries = mDBApi.metadata("/" + dirName, MAX_DROPBOX_FILES, null, true, null);

            // Move list of files into hashset
            retVal = new HashSet<String>();
            for( DropboxAPI.Entry entry : entries.contents )
            {
                retVal.add( entry.fileName() );
            }
        } catch( DropboxException e )
        {
            e.printStackTrace();
        }
    }
    return retVal;
}
 
开发者ID:bright-tools,项目名称:androidphotobackup,代码行数:24,代码来源:DropBoxWrapper.java

示例4: fileExists

import com.dropbox.client2.exception.DropboxException; //导入方法依赖的package包/类
public boolean fileExists(String fileName)
{
    boolean retVal = false;
    if( isConnected() ) {
        try {
            DropboxAPI.Entry existingEntry = mDBApi.metadata("/" + fileName, 1, null, false, null);
            if ((!existingEntry.isDir) && (!existingEntry.isDeleted)) {
                retVal = true;
            }
        } catch( DropboxException e )
        {
            e.printStackTrace();
        }
    }
    return retVal;
}
 
开发者ID:bright-tools,项目名称:androidphotobackup,代码行数:17,代码来源:DropBoxWrapper.java

示例5: doesFolderExist

import com.dropbox.client2.exception.DropboxException; //导入方法依赖的package包/类
private boolean doesFolderExist(String path) {
    try {
        DropboxAPI.Entry metadata = getFileInfo(path);
        return metadata.isDir;
    } catch (DropboxException e) {
        e.printStackTrace();
        return false;
    }
}
 
开发者ID:timothymiko,项目名称:narrate-android,代码行数:10,代码来源:DropboxSyncService.java

示例6: doesFileExist

import com.dropbox.client2.exception.DropboxException; //导入方法依赖的package包/类
/**
 * Returns 1 if it does exist
 * Returns 0 if it does not exist
 * Returns -1 if there is any other error
 *
 * @param path
 * @return
 */
private int doesFileExist(String path) {
    try {
        DropboxAPI.Entry metadata = getFileInfo(path);
        return 1;
    } catch (DropboxException e) {
        e.printStackTrace();
        if (e.toString().contains("404"))
            return 0;
        else
            return -1;
    }
}
 
开发者ID:timothymiko,项目名称:narrate-android,代码行数:21,代码来源:DropboxSyncService.java

示例7: downloadFileStream

import com.dropbox.client2.exception.DropboxException; //导入方法依赖的package包/类
/**
 * Downloads a file from the dropbox and returns an InputStream.
 *
 * @param path The file path within the dropbox
 * @return The InputStream to the file
 */
public InputStream downloadFileStream(String path) {
	DropboxAPI.DropboxInputStream stream = null;
	try {
		stream = mDBApi.getFileStream(path, null);
	} catch (DropboxException e) {
		e.printStackTrace();
	}
	return stream;
}
 
开发者ID:Rohde-Schwarz-Cybersecurity,项目名称:PanBox,代码行数:16,代码来源:DropboxConnector.java

示例8: createFolder

import com.dropbox.client2.exception.DropboxException; //导入方法依赖的package包/类
/**
 * Creates a new folder at given path
 *
 * @param path Path to the new folder
 * @return true if creation was successful, false otherwise
 */
@Override
public boolean createFolder(String path) {
	try {
		mDBApi.createFolder(path);
		return true;
	} catch (DropboxException e) {
		e.printStackTrace();
		return false;
	}
}
 
开发者ID:Rohde-Schwarz-Cybersecurity,项目名称:PanBox,代码行数:17,代码来源:DropboxConnector.java

示例9: deleteFile

import com.dropbox.client2.exception.DropboxException; //导入方法依赖的package包/类
/**
 * Deletes a file or folder from the dropbox
 *
 * @param path Path to file or folder in dropbox
 * @return true, if deletion successful, false otherwise
 */
@Override
public boolean deleteFile(String path) {
	try {
		mDBApi.delete(path);
		return true;
	} catch (DropboxException e) {
		e.printStackTrace();
		return false;
	}
}
 
开发者ID:Rohde-Schwarz-Cybersecurity,项目名称:PanBox,代码行数:17,代码来源:DropboxConnector.java

示例10: copyFile

import com.dropbox.client2.exception.DropboxException; //导入方法依赖的package包/类
/**
 * Copys a file from one location to another.
 *
 * @param source Path to source file
 * @param dest   Path to destination
 * @return true if successful, false otherwise
 */
@Override
public boolean copyFile(String source, String dest) {
	try {
		mDBApi.copy(source, dest);
		return true;
	} catch (DropboxException e) {
		e.printStackTrace();
		return false;
	}
}
 
开发者ID:Rohde-Schwarz-Cybersecurity,项目名称:PanBox,代码行数:18,代码来源:DropboxConnector.java

示例11: moveFile

import com.dropbox.client2.exception.DropboxException; //导入方法依赖的package包/类
/**
 * Move a file from one location to another.
 *
 * @param source Path to source file
 * @param dest   Path to destination
 * @return true if successful, false otherwise
 */
@Override
public boolean moveFile(String source, String dest) {
	try {
		mDBApi.move(source, dest);
		return true;
	} catch (DropboxException e) {
		e.printStackTrace();
		return false;
	}
}
 
开发者ID:Rohde-Schwarz-Cybersecurity,项目名称:PanBox,代码行数:18,代码来源:DropboxConnector.java

示例12: getFileInfo

import com.dropbox.client2.exception.DropboxException; //导入方法依赖的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

示例13: getUserAccountInfo

import com.dropbox.client2.exception.DropboxException; //导入方法依赖的package包/类
public Account getUserAccountInfo(){
	try {
		return mDBApi.accountInfo();
	} catch (DropboxException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	return null;
}
 
开发者ID:Rohde-Schwarz-Cybersecurity,项目名称:PanBox,代码行数:10,代码来源:DropboxConnector.java

示例14: upload

import com.dropbox.client2.exception.DropboxException; //导入方法依赖的package包/类
boolean upload( String fileName, InputStream in ) throws IOException, DropboxException
{
    boolean allOk = true;

    // TODO: Check that there's enough quota

    DropboxAPI.Entry uploadedFileMetadata;
    try {
        DropboxAPI.ChunkedUploader uploader = mDBApi.getChunkedUploader(in);
        int retryCounter = 0;
        while(!uploader.isComplete()) {
            try {
                uploader.upload();
            } catch (DropboxException e) {
                if (retryCounter > MAX_RETRIES)
                {
                    e.printStackTrace();
                    allOk = false;
                    break;  // Give up after a while.
                }
                retryCounter++;
                // Maybe wait a few seconds before retrying?
            }
        }
        if( allOk ) {
            uploadedFileMetadata = uploader.finish("/"+fileName, null);
            Log.d(TAG, "Uploaded " + uploadedFileMetadata.fileName() + ", size: " + uploadedFileMetadata.size);
        } else {
            Log.d(TAG, "Upload of "+fileName+" failed");

        }
    } finally {
        in.close();
    }
    return allOk;
}
 
开发者ID:bright-tools,项目名称:androidphotobackup,代码行数:37,代码来源:DropBoxWrapper.java

示例15: putFile

import com.dropbox.client2.exception.DropboxException; //导入方法依赖的package包/类
public Entry putFile(String name, InputStream in, int size) {
    try {
        return mDBApi.putFile(name, in, size, null, null);
    } catch (DropboxException e) {
        e.printStackTrace();
    }
    return null;
}
 
开发者ID:sys1yagi,项目名称:DropboxPrintService,代码行数:9,代码来源:DropboxAPISession.java


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