Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: components/cronet/android/api/src/org/chromium/net/UploadDataProviders.java

Issue 1983123002: Fix UploadDataProviders.create(byte[], offset, count) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | components/cronet/android/test/javatests/src/org/chromium/net/UploadDataProvidersTest.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 android.os.ParcelFileDescriptor; 7 import android.os.ParcelFileDescriptor;
8 8
9 import java.io.File; 9 import java.io.File;
10 import java.io.FileInputStream; 10 import java.io.FileInputStream;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 } 62 }
63 63
64 /** 64 /**
65 * Uploads {@code length} bytes from {@code data}, starting from {@code offs et} 65 * Uploads {@code length} bytes from {@code data}, starting from {@code offs et}
66 * @param data Array containing data to upload 66 * @param data Array containing data to upload
67 * @param offset Offset within data to start with 67 * @param offset Offset within data to start with
68 * @param length Number of bytes to upload 68 * @param length Number of bytes to upload
69 * @return A new UploadDataProvider for the given data 69 * @return A new UploadDataProvider for the given data
70 */ 70 */
71 public static UploadDataProvider create(byte[] data, int offset, int length) { 71 public static UploadDataProvider create(byte[] data, int offset, int length) {
72 return new ByteBufferUploadProvider(ByteBuffer.wrap(data, offset, length )); 72 return new ByteBufferUploadProvider(ByteBuffer.wrap(data, offset, length ).slice());
73 } 73 }
74 74
75 /** 75 /**
76 * Uploads the contents of {@code data} 76 * Uploads the contents of {@code data}
77 * @param data Array containing data to upload 77 * @param data Array containing data to upload
78 * @return A new UploadDataProvider for the given data 78 * @return A new UploadDataProvider for the given data
79 */ 79 */
80 public static UploadDataProvider create(byte[] data) { 80 public static UploadDataProvider create(byte[] data) {
81 return create(data, 0, data.length); 81 return create(data, 0, data.length);
82 } 82 }
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 @Override 177 @Override
178 public void rewind(UploadDataSink uploadDataSink) { 178 public void rewind(UploadDataSink uploadDataSink) {
179 mUploadBuffer.position(0); 179 mUploadBuffer.position(0);
180 uploadDataSink.onRewindSucceeded(); 180 uploadDataSink.onRewindSucceeded();
181 } 181 }
182 } 182 }
183 183
184 // Prevent instantiation 184 // Prevent instantiation
185 private UploadDataProviders() {} 185 private UploadDataProviders() {}
186 } 186 }
OLDNEW
« no previous file with comments | « no previous file | components/cronet/android/test/javatests/src/org/chromium/net/UploadDataProvidersTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698