File tree Expand file tree Collapse file tree 3 files changed +274
-52
lines changed
Parse/src/main/java/com/parse Expand file tree Collapse file tree 3 files changed +274
-52
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) 2015-present, Parse, LLC.
3+ * All rights reserved.
4+ *
5+ * This source code is licensed under the BSD-style license found in the
6+ * LICENSE file in the root directory of this source tree. An additional grant
7+ * of patent rights can be found in the PATENTS file in the same directory.
8+ */
9+ package com .parse ;
10+
11+ import java .io .InputStream ;
12+
13+ /**
14+ * A {@code GetDataStreamCallback} is used to run code after a {@link ParseFile} fetches its data on
15+ * a background thread.
16+ * <p/>
17+ * The easiest way to use a {@code GetDataStreamCallback} is through an anonymous inner class.
18+ * Override the {@code done} function to specify what the callback should do after the fetch is
19+ * complete. The {@code done} function will be run in the UI thread, while the fetch happens in a
20+ * background thread. This ensures that the UI does not freeze while the fetch happens.
21+ * <p/>
22+ * <pre>
23+ * file.getDataStreamInBackground(new GetDataStreamCallback() {
24+ * public void done(InputSteam input, ParseException e) {
25+ * // ...
26+ * }
27+ * });
28+ * </pre>
29+ */
30+ public interface GetDataStreamCallback extends ParseCallback2 <InputStream , ParseException > {
31+ /**
32+ * Override this function with the code you want to run after the fetch is complete.
33+ *
34+ * @param input
35+ * The data that was retrieved, or {@code null} if it did not succeed.
36+ * @param e
37+ * The exception raised by the fetch, or {@code null} if it succeeded.
38+ */
39+ @ Override
40+ public void done (InputStream input , ParseException e );
41+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) 2015-present, Parse, LLC.
3+ * All rights reserved.
4+ *
5+ * This source code is licensed under the BSD-style license found in the
6+ * LICENSE file in the root directory of this source tree. An additional grant
7+ * of patent rights can be found in the PATENTS file in the same directory.
8+ */
9+ package com .parse ;
10+
11+ import java .io .File ;
12+
13+ /**
14+ * A {@code GetFileCallback} is used to run code after a {@link ParseFile} fetches its data on
15+ * a background thread.
16+ * <p/>
17+ * The easiest way to use a {@code GetFileCallback} is through an anonymous inner class.
18+ * Override the {@code done} function to specify what the callback should do after the fetch is
19+ * complete. The {@code done} function will be run in the UI thread, while the fetch happens in a
20+ * background thread. This ensures that the UI does not freeze while the fetch happens.
21+ * <p/>
22+ * <pre>
23+ * file.getFileInBackground(new GetFileCallback() {
24+ * public void done(File file, ParseException e) {
25+ * // ...
26+ * }
27+ * });
28+ * </pre>
29+ */
30+ public interface GetFileCallback extends ParseCallback2 <File , ParseException > {
31+ /**
32+ * Override this function with the code you want to run after the fetch is complete.
33+ *
34+ * @param file
35+ * The data that was retrieved, or {@code null} if it did not succeed.
36+ * @param e
37+ * The exception raised by the fetch, or {@code null} if it succeeded.
38+ */
39+ @ Override
40+ public void done (File file , ParseException e );
41+ }
You can’t perform that action at this time.
0 commit comments