OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.net; | 5 package org.chromium.net; |
6 | 6 |
7 import java.io.IOException; | 7 import java.io.IOException; |
8 import java.nio.ByteBuffer; | 8 import java.nio.ByteBuffer; |
9 import java.nio.channels.ReadableByteChannel; | 9 import java.nio.channels.ReadableByteChannel; |
10 | 10 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 * @param contentType MIME type of the post content or null if this is not a | 51 * @param contentType MIME type of the post content or null if this is not a |
52 * POST. | 52 * POST. |
53 * @param data The content that needs to be uploaded if this is a POST | 53 * @param data The content that needs to be uploaded if this is a POST |
54 * request. | 54 * request. |
55 */ | 55 */ |
56 void setUploadData(String contentType, byte[] data); | 56 void setUploadData(String contentType, byte[] data); |
57 | 57 |
58 /** | 58 /** |
59 * Sets a readable byte channel to upload as part of a POST request. | 59 * Sets a readable byte channel to upload as part of a POST request. |
60 * | 60 * |
| 61 * <p>Once {@link #start()} is called, this channel is guaranteed to be |
| 62 * closed, either when the upload completes, or when it is canceled. |
| 63 * |
61 * @param contentType MIME type of the post content or null if this is not a | 64 * @param contentType MIME type of the post content or null if this is not a |
62 * POST. | 65 * POST. |
63 * @param channel The channel to read to read upload data from if this is a | 66 * @param channel The channel to read to read upload data from if this is a |
64 * POST request. | 67 * POST request. |
65 */ | 68 */ |
66 void setUploadChannel(String contentType, ReadableByteChannel channel); | 69 void setUploadChannel(String contentType, ReadableByteChannel channel); |
67 | 70 |
68 /** | 71 /** |
69 * Start executing the request. | 72 * Start executing the request. |
70 * <p> | 73 * <p> |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 109 |
107 /** | 110 /** |
108 * Returns the HTTP status code. It may be 0 if the request has not started | 111 * Returns the HTTP status code. It may be 0 if the request has not started |
109 * or failed before getting the status code from the server. If the status | 112 * or failed before getting the status code from the server. If the status |
110 * code is 206 (partial response) after {@link #setOffset} is called, the | 113 * code is 206 (partial response) after {@link #setOffset} is called, the |
111 * method returns 200. | 114 * method returns 200. |
112 */ | 115 */ |
113 int getHttpStatusCode(); | 116 int getHttpStatusCode(); |
114 | 117 |
115 /** | 118 /** |
| 119 * Returns the response header value for the given name or {@code null} if |
| 120 * not found. |
| 121 */ |
| 122 String getHeader(String name); |
| 123 |
| 124 |
| 125 /** |
116 * Returns the exception that occurred while executing the request of null | 126 * Returns the exception that occurred while executing the request of null |
117 * if the request was successful. | 127 * if the request was successful. |
118 */ | 128 */ |
119 IOException getException(); | 129 IOException getException(); |
120 } | 130 } |
OLD | NEW |