summaryrefslogtreecommitdiff
path: root/javaunohelper
diff options
context:
space:
mode:
authorrbuj <robert.buj@gmail.com>2014-08-11 03:15:20 +0200
committerDavid Tardon <dtardon@redhat.com>2014-08-11 06:23:11 +0000
commit8d10b7373a1c77748f2119b64a3dd99f453137fe (patch)
treeb5bc89d170833757570a5cbcf8c8c61694fc27ac /javaunohelper
parent608f330e22e25772eb888fa33d64f9b79c0ffcc8 (diff)
javaunohelper: enhancements in decodeUTF8
Change-Id: I452dbd54251eea683d307c346dc4949a42eedc30 Reviewed-on: https://gerrit.libreoffice.org/10862 Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'javaunohelper')
-rw-r--r--javaunohelper/com/sun/star/lib/uno/helper/UnoUrl.java15
1 files changed, 5 insertions, 10 deletions
diff --git a/javaunohelper/com/sun/star/lib/uno/helper/UnoUrl.java b/javaunohelper/com/sun/star/lib/uno/helper/UnoUrl.java
index 0bae9d0efc2a..ac5f05e59d6e 100644
--- a/javaunohelper/com/sun/star/lib/uno/helper/UnoUrl.java
+++ b/javaunohelper/com/sun/star/lib/uno/helper/UnoUrl.java
@@ -18,8 +18,8 @@
package com.sun.star.lib.uno.helper;
import java.io.UnsupportedEncodingException;
+import java.nio.ByteBuffer;
import java.util.HashMap;
-import java.util.ArrayList;
/**
* Object representation and parsing of Uno Urls,
@@ -208,8 +208,8 @@ public class UnoUrl {
try {
if (s.contains("%")) {
- ArrayList<Integer> v = new ArrayList<Integer>();
int length = s.length();
+ ByteBuffer bb = ByteBuffer.allocate(length);
for (int i = 0; i < length; i++) {
int ch = s.charAt(i);
@@ -228,16 +228,11 @@ public class UnoUrl {
i+=2;
}
- v.add(new Integer(ch));
- }
-
- int size = v.size();
- byte[] bytes = new byte[size];
- for (int i = 0; i < size; i++) {
- Integer anInt = v.get(i);
- bytes[i] = (byte) (anInt.intValue() & 0xFF);
+ bb.put((byte) (ch & 0xFF));
}
+ byte[] bytes = new byte[bb.position()];
+ System.arraycopy(bb.array(), 0, bytes, 0, bytes.length);
return new String(bytes, "UTF-8");
} else {