am 0c2d82c6: am 848a1e3d: Merge "OBEX: Fix PrivateOutputStream small write problem"

* commit '0c2d82c6f28ab6ec73d66fcc1f62e067829df426':
  OBEX: Fix PrivateOutputStream small write problem
This commit is contained in:
Jaikumar Ganesh
2011-05-20 10:51:25 -07:00
committed by Android Git Automerger

View File

@@ -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);
}
}