Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 23009845 authored by Jaikumar Ganesh's avatar Jaikumar Ganesh Committed by Android Git Automerger
Browse files

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

* commit '3bec9cc2':
  OBEX: Fix PrivateOutputStream small write problem
parents ab68f52d 3bec9cc2
Loading
Loading
Loading
Loading
+9 −12
Original line number Diff line number Diff line
@@ -107,20 +107,17 @@ 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;
        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);
        }
    }
    }

    /**
     * Reads the bytes that have been written to this stream.