aboutsummaryrefslogtreecommitdiff
path: root/velocity-engine-core/src/main/java/org/apache/velocity/io
diff options
context:
space:
mode:
authorClaude Brisson <cbrisson@apache.org>2016-07-15 07:13:01 +0000
committerClaude Brisson <cbrisson@apache.org>2016-07-15 07:13:01 +0000
commit5005d42a00febec2a623ab55bae4920d4c628ba4 (patch)
tree5b8ed1881f55ec786fb0afbcf09e50648d3305c1 /velocity-engine-core/src/main/java/org/apache/velocity/io
parent440af3d6b7649e7a122767547107deabd8bb5477 (diff)
downloadapache-velocity-engine-5005d42a00febec2a623ab55bae4920d4c628ba4.tar.gz
ResourceLoaders now use Readers rather than InputStreams. InputStream API has been deprecated.
git-svn-id: https://svn.apache.org/repos/asf/velocity/engine/trunk@1752784 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'velocity-engine-core/src/main/java/org/apache/velocity/io')
-rw-r--r--velocity-engine-core/src/main/java/org/apache/velocity/io/UnicodeInputStream.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/io/UnicodeInputStream.java b/velocity-engine-core/src/main/java/org/apache/velocity/io/UnicodeInputStream.java
index 3fcefb28..a7403b61 100644
--- a/velocity-engine-core/src/main/java/org/apache/velocity/io/UnicodeInputStream.java
+++ b/velocity-engine-core/src/main/java/org/apache/velocity/io/UnicodeInputStream.java
@@ -56,14 +56,12 @@ public class UnicodeInputStream
/**
* BOM Marker for UTF 32, little endian. See http://www.unicode.org/unicode/faq/utf_bom.html
*
- * TODO: Does Java actually support this?
*/
public static final UnicodeBOM UTF32LE_BOM = new UnicodeBOM("UTF-32LE", new byte [] { (byte)0xff, (byte)0xfe, (byte)0x00, (byte)0x00 });
/**
* BOM Marker for UTF 32, big endian. See http://www.unicode.org/unicode/faq/utf_bom.html
*
- * TODO: Does Java actually support this?
*/
public static final UnicodeBOM UTF32BE_BOM = new UnicodeBOM("UTF-32BE", new byte [] { (byte)0x00, (byte)0x00, (byte)0xfe, (byte)0xff });
@@ -340,6 +338,17 @@ public class UnicodeInputStream
return inputStream.skip(n);
}
+
+ /**
+ * Helper function to compare encodings
+ */
+ public static boolean sameEncoding(String left, String right)
+ {
+ left = left.toUpperCase().replace("-", "");
+ right = right.toUpperCase().replace("-", "");
+ return left.equals(right);
+ }
+
/**
* Helper class to bundle encoding and BOM marker.
*