Skip to content

Add new ParseFile download api #113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Parse/src/main/java/com/parse/GetDataCallback.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ public interface GetDataCallback extends ParseCallback2<byte[], ParseException>
@Override
public void done(byte[] data, ParseException e);
}

41 changes: 41 additions & 0 deletions Parse/src/main/java/com/parse/GetDataStreamCallback.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright (c) 2015-present, Parse, LLC.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
package com.parse;

import java.io.InputStream;

/**
* A {@code GetDataStreamCallback} is used to run code after a {@link ParseFile} fetches its data on
* a background thread.
* <p/>
* The easiest way to use a {@code GetDataStreamCallback} is through an anonymous inner class.
* Override the {@code done} function to specify what the callback should do after the fetch is
* complete. The {@code done} function will be run in the UI thread, while the fetch happens in a
* background thread. This ensures that the UI does not freeze while the fetch happens.
* <p/>
* <pre>
* file.getDataStreamInBackground(new GetDataStreamCallback() {
* public void done(InputSteam input, ParseException e) {
* // ...
* }
* });
* </pre>
*/
public interface GetDataStreamCallback extends ParseCallback2<InputStream, ParseException> {
/**
* Override this function with the code you want to run after the fetch is complete.
*
* @param input
* The data that was retrieved, or {@code null} if it did not succeed.
* @param e
* The exception raised by the fetch, or {@code null} if it succeeded.
*/
@Override
public void done(InputStream input, ParseException e);
}
41 changes: 41 additions & 0 deletions Parse/src/main/java/com/parse/GetFileCallback.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright (c) 2015-present, Parse, LLC.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
package com.parse;

import java.io.File;

/**
* A {@code GetFileCallback} is used to run code after a {@link ParseFile} fetches its data on
* a background thread.
* <p/>
* The easiest way to use a {@code GetFileCallback} is through an anonymous inner class.
* Override the {@code done} function to specify what the callback should do after the fetch is
* complete. The {@code done} function will be run in the UI thread, while the fetch happens in a
* background thread. This ensures that the UI does not freeze while the fetch happens.
* <p/>
* <pre>
* file.getFileInBackground(new GetFileCallback() {
* public void done(File file, ParseException e) {
* // ...
* }
* });
* </pre>
*/
public interface GetFileCallback extends ParseCallback2<File, ParseException> {
/**
* Override this function with the code you want to run after the fetch is complete.
*
* @param file
* The data that was retrieved, or {@code null} if it did not succeed.
* @param e
* The exception raised by the fetch, or {@code null} if it succeeded.
*/
@Override
public void done(File file, ParseException e);
}
Loading