diff options
-rw-r--r-- | javaunohelper/com/sun/star/lib/uno/helper/UnoUrl.java | 15 |
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 { |