diff options
author | Brad Fitzpatrick <bradfitz@android.com> | 2010-11-16 09:40:52 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-11-16 09:40:52 -0800 |
commit | f342ac918234b5db4f7ed54e5b20d2277a3c2df7 (patch) | |
tree | 4c435457bad5422285199bd96deb96faf1bde7c9 | |
parent | 4e74e181d1f06b31ebe98589dbe2ee9ddb722173 (diff) | |
parent | 8443dd16c2dfd5f56e33fbe76129f56e6a83b23e (diff) | |
download | frameworks_base-f342ac918234b5db4f7ed54e5b20d2277a3c2df7.zip frameworks_base-f342ac918234b5db4f7ed54e5b20d2277a3c2df7.tar.gz frameworks_base-f342ac918234b5db4f7ed54e5b20d2277a3c2df7.tar.bz2 |
am 8443dd16: am 383e95e2: Merge "DropBox: Read until the end of stream has been reached"
* commit '8443dd16c2dfd5f56e33fbe76129f56e6a83b23e':
DropBox: Read until the end of stream has been reached
-rw-r--r-- | core/java/android/os/DropBoxManager.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/core/java/android/os/DropBoxManager.java b/core/java/android/os/DropBoxManager.java index a47c66a..47a7696 100644 --- a/core/java/android/os/DropBoxManager.java +++ b/core/java/android/os/DropBoxManager.java @@ -169,7 +169,12 @@ public class DropBoxManager { is = getInputStream(); if (is == null) return null; byte[] buf = new byte[maxBytes]; - return new String(buf, 0, Math.max(0, is.read(buf))); + int readBytes = 0; + int n = 0; + while (n >= 0 && (readBytes += n) < maxBytes) { + n = is.read(buf, readBytes, maxBytes - readBytes); + } + return new String(buf, 0, readBytes); } catch (IOException e) { return null; } finally { |