Skip to content

Instantly share code, notes, and snippets.

@soulfly
Last active October 22, 2015 08:59
Show Gist options
  • Save soulfly/1cd969e9364792802099 to your computer and use it in GitHub Desktop.
Save soulfly/1cd969e9364792802099 to your computer and use it in GitHub Desktop.
final int fileId = 2641910;
QBContent.downloadFileTask(fileId, new QBEntityCallbackImpl<InputStream>(){
@Override
public void onSuccess(final InputStream inputStream, Bundle params) {
long length = params.getLong(Consts.CONTENT_LENGTH_TAG);
Log.i(TAG, "content.length: " + length);
Thread thread = new Thread() {
@Override
public void run() {
try {
while(true) {
byte[] data = ByteStreams.toByteArray(inputStream);
}
} catch (IOException e) {
e.printStackTrace();
}
}
};
thread.start();
}
@Override
public void onError(List<String> errors) {
handleErrors(errors);
}
}, new QBProgressCallback() {
@Override
public void onProgressUpdate(int progress) {
Log.i(TAG, "progress: " + progress);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment