summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsrc/com/android/bluetooth/pbap/BluetoothPbapObexServer.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/com/android/bluetooth/pbap/BluetoothPbapObexServer.java b/src/com/android/bluetooth/pbap/BluetoothPbapObexServer.java
index fa645ff05..42c078d48 100755
--- a/src/com/android/bluetooth/pbap/BluetoothPbapObexServer.java
+++ b/src/com/android/bluetooth/pbap/BluetoothPbapObexServer.java
@@ -670,7 +670,8 @@ public class BluetoothPbapObexServer extends ServerRequestHandler {
return ResponseCodes.OBEX_HTTP_OK;
}
- int vcardStringLen = vcardString.length();
+ byte[] vcardBytes = vcardString.getBytes();
+ int vcardStringLen = vcardBytes.length;
if (D) Log.d(TAG, "Send Data: len=" + vcardStringLen);
OutputStream outputStream = null;
@@ -697,9 +698,9 @@ public class BluetoothPbapObexServer extends ServerRequestHandler {
if (vcardStringLen - position < outputBufferSize) {
readLength = vcardStringLen - position;
}
- String subStr = vcardString.substring(position, position + readLength);
+ byte[] subByteArray = Arrays.copyOfRange(vcardBytes, position, position + readLength);
try {
- outputStream.write(subStr.getBytes(), 0, readLength);
+ outputStream.write(subByteArray, 0, readLength);
} catch (IOException e) {
Log.e(TAG, "write outputstrem failed" + e.toString());
pushResult = ResponseCodes.OBEX_HTTP_INTERNAL_ERROR;