Line | |
---|
1 | /*
|
---|
2 | * To change this template, choose Tools | Templates
|
---|
3 | * and open the template in the editor.
|
---|
4 | */
|
---|
5 |
|
---|
6 | package com.kitfox.svg.xml;
|
---|
7 |
|
---|
8 | /**
|
---|
9 | *
|
---|
10 | * @author kitfox
|
---|
11 | */
|
---|
12 | public class Base64Util
|
---|
13 | {
|
---|
14 | static final byte[] valueToBase64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".getBytes();
|
---|
15 | static final byte[] base64ToValue = new byte[128];
|
---|
16 | static {
|
---|
17 | for (int i = 0; i < valueToBase64.length; ++i)
|
---|
18 | {
|
---|
19 | base64ToValue[valueToBase64[i]] = (byte)i;
|
---|
20 | }
|
---|
21 | }
|
---|
22 |
|
---|
23 | static public byte encodeByte(int value)
|
---|
24 | {
|
---|
25 | return valueToBase64[value];
|
---|
26 | }
|
---|
27 |
|
---|
28 | static public byte decodeByte(int base64Char)
|
---|
29 | {
|
---|
30 | return base64ToValue[base64Char];
|
---|
31 | }
|
---|
32 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.