Merge "OBEX: Fix PrivateOutputStream small write problem"
This commit is contained in:
@ -107,20 +107,17 @@ public final class PrivateOutputStream extends OutputStream {
|
|||||||
|
|
||||||
ensureOpen();
|
ensureOpen();
|
||||||
mParent.ensureNotDone();
|
mParent.ensureNotDone();
|
||||||
if (count < mMaxPacketSize) {
|
while ((mArray.size() + remainLength) >= mMaxPacketSize) {
|
||||||
mArray.write(buffer, offset, count);
|
int bufferLeft = mMaxPacketSize - mArray.size();
|
||||||
} else {
|
mArray.write(buffer, offset1, bufferLeft);
|
||||||
while (remainLength >= mMaxPacketSize) {
|
offset1 += bufferLeft;
|
||||||
mArray.write(buffer, offset1, mMaxPacketSize);
|
remainLength -= bufferLeft;
|
||||||
offset1 += mMaxPacketSize;
|
|
||||||
remainLength = count - offset1;
|
|
||||||
mParent.continueOperation(true, false);
|
mParent.continueOperation(true, false);
|
||||||
}
|
}
|
||||||
if (remainLength > 0) {
|
if (remainLength > 0) {
|
||||||
mArray.write(buffer, offset1, remainLength);
|
mArray.write(buffer, offset1, remainLength);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads the bytes that have been written to this stream.
|
* Reads the bytes that have been written to this stream.
|
||||||
|
Reference in New Issue
Block a user