summaryrefslogtreecommitdiffstats
path: root/obex
diff options
context:
space:
mode:
authorJaikumar Ganesh <jaikumarg@android.com>2011-05-20 10:51:25 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2011-05-20 10:51:25 -0700
commit3bec9cc27a4b87be644533d5fe44358dde399d49 (patch)
tree48bba09f3fea9673db74cd993221004f76653942 /obex
parent33bdc3c9995cbef477cec756b65d767558e6b836 (diff)
parent0c2d82c6f28ab6ec73d66fcc1f62e067829df426 (diff)
downloadframeworks_base-3bec9cc27a4b87be644533d5fe44358dde399d49.zip
frameworks_base-3bec9cc27a4b87be644533d5fe44358dde399d49.tar.gz
frameworks_base-3bec9cc27a4b87be644533d5fe44358dde399d49.tar.bz2
am 0c2d82c6: am 848a1e3d: Merge "OBEX: Fix PrivateOutputStream small write problem"
* commit '0c2d82c6f28ab6ec73d66fcc1f62e067829df426': OBEX: Fix PrivateOutputStream small write problem
Diffstat (limited to 'obex')
-rw-r--r--obex/javax/obex/PrivateOutputStream.java21
1 files changed, 9 insertions, 12 deletions
diff --git a/obex/javax/obex/PrivateOutputStream.java b/obex/javax/obex/PrivateOutputStream.java
index ca420af..713f4ae 100644
--- a/obex/javax/obex/PrivateOutputStream.java
+++ b/obex/javax/obex/PrivateOutputStream.java
@@ -107,18 +107,15 @@ public final class PrivateOutputStream extends OutputStream {
ensureOpen();
mParent.ensureNotDone();
- if (count < mMaxPacketSize) {
- mArray.write(buffer, offset, count);
- } else {
- while (remainLength >= mMaxPacketSize) {
- mArray.write(buffer, offset1, mMaxPacketSize);
- offset1 += mMaxPacketSize;
- remainLength = count - offset1;
- mParent.continueOperation(true, false);
- }
- if (remainLength > 0) {
- mArray.write(buffer, offset1, remainLength);
- }
+ while ((mArray.size() + remainLength) >= mMaxPacketSize) {
+ int bufferLeft = mMaxPacketSize - mArray.size();
+ mArray.write(buffer, offset1, bufferLeft);
+ offset1 += bufferLeft;
+ remainLength -= bufferLeft;
+ mParent.continueOperation(true, false);
+ }
+ if (remainLength > 0) {
+ mArray.write(buffer, offset1, remainLength);
}
}