-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBase64 Enc en PS.txt
More file actions
14 lines (14 loc) · 1.05 KB
/
Base64 Enc en PS.txt
File metadata and controls
14 lines (14 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
REM substitute TABLE__TBL for your table a field
REM ** create an instance of the Java base64 encoder;
Local JavaObject &encoder = CreateJavaObject("sun.misc.BASE64Encoder");
REM ** get a reference to a Java class instance for the primitive byte array;
Local JavaObject &arrayClass = GetJavaClass("java.lang.reflect.Array");
Local JavaObject &bytArrClass = &arrayClass.newInstance(GetJavaClass("java.lang.Byte").TYPE, 0);
REM ** use reflection to get a reference to the method we want to call;
Local JavaObject &encodeArgTypes = CreateJavaObject("java.lang.Class[]", &bytArrClass.getClass());
Local JavaObject &encodeMethod = &encoder.getClass().getMethod("encode", &encodeArgTypes);
REM ** call the method;
Local JavaObject &bytes = CreateJavaObject("java.lang.String", TABLE__TBL.DESCR_WBTG.Value).getBytes();
Local JavaObject &result = &encodeMethod.invoke(&encoder, CreateJavaObject("java.lang.Object[]", &bytes));
REM ** print the result;
TABLE__TBL.DESCR_WBTG.Value = TABLE__TBL.DESCR_WBTG.Value | " --- EN BASE 64 es --- " | Char(13) | &result.toString();