|
From: <de...@us...> - 2012-10-19 11:02:46
|
Revision: 7767
http://fudaa.svn.sourceforge.net/fudaa/?rev=7767&view=rev
Author: deniger
Date: 2012-10-19 11:02:35 +0000 (Fri, 19 Oct 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/xml/UnicodeInputStream.java
Modified: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/xml/UnicodeInputStream.java
===================================================================
--- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/xml/UnicodeInputStream.java 2012-10-19 11:00:40 UTC (rev 7766)
+++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/xml/UnicodeInputStream.java 2012-10-19 11:02:35 UTC (rev 7767)
@@ -37,6 +37,42 @@
else in = new InputStreamReader(uin, enc);
*/
public class UnicodeInputStream extends InputStream {
+
+ public static byte[] getBOM(String enc) {
+ if (XmlVersionFinder.ENCODING.equals(enc)) {
+ byte[] bom = new byte[3];
+ bom[0] = (byte) 239;
+ bom[1] = (byte) 187;
+ bom[2] = (byte) 191;
+ return bom;
+ } else if ("UTF-16BE".equals(enc)) {
+ byte[] bom = new byte[2];
+ bom[0] = (byte) 254;
+ bom[1] = (byte) 255;
+ return bom;
+ } else if ("UTF-16LE".equals(enc)) {
+ byte[] bom = new byte[2];
+ bom[0] = (byte) 255;
+ bom[1] = (byte) 254;
+ return bom;
+ } else if ("UTF-32BE".equals(enc)) {
+ byte[] bom = new byte[4];
+ bom[0] = (byte) 0;
+ bom[1] = (byte) 0;
+ bom[2] = (byte) 254;
+ bom[3] = (byte) 255;
+ return bom;
+ } else if ("UTF-32LE".equals(enc)) {
+ byte[] bom = new byte[4];
+ bom[0] = (byte) 0;
+ bom[1] = (byte) 0;
+ bom[2] = (byte) 255;
+ bom[3] = (byte) 254;
+ return bom;
+ } else {
+ return null;
+ }
+ }
PushbackInputStream internalIn;
boolean isInited = false;
String defaultEnc;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|