diff options
author | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2015-07-06 09:11:16 +0200 |
---|---|---|
committer | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2015-07-06 09:11:16 +0200 |
commit | f2b754b03a2c1c4ff20c2c34387ecfcdc3ce1c16 (patch) | |
tree | a0bbd6efecbaf4421ec6fb5514177bc55abf85f3 /pdf-as-common/src/main/java/at/gv/egiz/pdfas | |
parent | 3671c7ea0a7a41dd641ce6f56c254781d72a529c (diff) | |
download | pdf-as-4-f2b754b03a2c1c4ff20c2c34387ecfcdc3ce1c16.tar.gz pdf-as-4-f2b754b03a2c1c4ff20c2c34387ecfcdc3ce1c16.tar.bz2 pdf-as-4-f2b754b03a2c1c4ff20c2c34387ecfcdc3ce1c16.zip |
added encoding decoding functions for UTF16 strings
Diffstat (limited to 'pdf-as-common/src/main/java/at/gv/egiz/pdfas')
-rw-r--r-- | pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/utils/StringUtils.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/utils/StringUtils.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/utils/StringUtils.java index dbea3c70..436fc95e 100644 --- a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/utils/StringUtils.java +++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/utils/StringUtils.java @@ -78,6 +78,24 @@ public class StringUtils { return value; } + public static String transformToUTF16(String test) + throws UnsupportedEncodingException{ + byte[] bytes = test.getBytes("UTF-8"); + return new String(bytes, "UTF-8"); + } + + public static byte[] applyUTF16Encoding(String text) + throws UnsupportedEncodingException{ + byte[] replace_bytes; + replace_bytes = text.getBytes("UTF-8"); + return replace_bytes; + } + + public static String unapplyUTF16Encoding(byte[] replace_bytes) throws UnsupportedEncodingException { + String text = new String(replace_bytes, "UTF-8"); + return text; + } + public static byte[] applyWinAnsiEncoding(String text) throws UnsupportedEncodingException { byte[] replace_bytes; |