• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2015 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 package org.chromium.net;
6 
7 /**
8  * Defines callbacks methods for {@link UploadDataProvider}. All methods may be called synchronously
9  * or asynchronously, on any thread.
10  */
11 public abstract class UploadDataSink {
12     /**
13      * Called by {@link UploadDataProvider} when a read succeeds.
14      *
15      * @param finalChunk For chunked uploads, {@code true} if this is the final read. It must be
16      * {@code false} for non-chunked uploads.
17      */
onReadSucceeded(boolean finalChunk)18     public abstract void onReadSucceeded(boolean finalChunk);
19 
20     /**
21      * Called by {@link UploadDataProvider} when a read fails.
22      *
23      * @param exception Exception passed on to the embedder.
24      */
onReadError(Exception exception)25     public abstract void onReadError(Exception exception);
26 
27     /** Called by {@link UploadDataProvider} when a rewind succeeds. */
onRewindSucceeded()28     public abstract void onRewindSucceeded();
29 
30     /**
31      * Called by {@link UploadDataProvider} when a rewind fails, or if rewinding uploads is not
32      * supported.
33      *
34      * @param exception Exception passed on to the embedder.
35      */
onRewindError(Exception exception)36     public abstract void onRewindError(Exception exception);
37 }
38