summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/kitfox/svg/xml/Base64Util.java
diff options
context:
space:
mode:
authorkitfox2008-02-28 07:46:15 +0100
committerkitfox2008-02-28 07:46:15 +0100
commit9551fc304e04f5014746eb4631aadf7953b46a83 (patch)
treed82236a587003b328960914fddc9bd4b39626a2e /src/main/java/com/kitfox/svg/xml/Base64Util.java
parentUpdated color parsing to handle rgb percentages (diff)
downloadsvg-salamander-core-9551fc304e04f5014746eb4631aadf7953b46a83.tar.gz
svg-salamander-core-9551fc304e04f5014746eb4631aadf7953b46a83.tar.xz
svg-salamander-core-9551fc304e04f5014746eb4631aadf7953b46a83.zip
Added Base64 stream codecs. Added Main-Class attribute to generated jars.
git-svn-id: https://svn.java.net/svn/svgsalamander~svn/trunk/svg-core@52 7dc7fa77-23fb-e6ad-8e2e-c86bd48ed22b
Diffstat (limited to 'src/main/java/com/kitfox/svg/xml/Base64Util.java')
-rwxr-xr-xsrc/main/java/com/kitfox/svg/xml/Base64Util.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/main/java/com/kitfox/svg/xml/Base64Util.java b/src/main/java/com/kitfox/svg/xml/Base64Util.java
new file mode 100755
index 0000000..a95b9d4
--- /dev/null
+++ b/src/main/java/com/kitfox/svg/xml/Base64Util.java
@@ -0,0 +1,32 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package com.kitfox.svg.xml;
+
+/**
+ *
+ * @author kitfox
+ */
+public class Base64Util
+{
+ static final byte[] valueToBase64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".getBytes();
+ static final byte[] base64ToValue = new byte[128];
+ static {
+ for (int i = 0; i < valueToBase64.length; ++i)
+ {
+ base64ToValue[valueToBase64[i]] = (byte)i;
+ }
+ }
+
+ static public byte encodeByte(int value)
+ {
+ return valueToBase64[value];
+ }
+
+ static public byte decodeByte(int base64Char)
+ {
+ return base64ToValue[base64Char];
+ }
+}