|
Ok, I've decided to forgo the RPG Route and obtained a Base64 routine written in Java from apache.org. It has a decode method that accepts a byte[] array as an argument and returns a byte array. Here is my procedure. Hoption(*nodebugio:*srcstmt) NOMAIN thread(*serialize) DdecodeBase64 PR 32767 varying D inputString 32767 const DstringObject S O class(*JAVA:'java.lang.String') DbyteObject S O class(*JAVA:'java.lang.Byte') Dbase64Class S O class(*JAVA:'org.apache.commons.- D httpclient.util.Base64') DnewByteArray PR O extProc(*JAVA:'java.lang.Byte': D *CONSTRUCTOR) D O class(*JAVA:'java.lang.String') D CONST DnewString PR O extproc(*JAVA:'java.lang.String': D *CONSTRUCTOR) D 32767a const varying options(*varsize) DnewBase64Class PR O extproc(*JAVA:'org.apache.commons.- D httpclient.util.Base64': D *CONSTRUCTOR) Ddecode PR o extproc(*JAVA:'org.apache.commons.- D httpclient.util.Base64': D 'decode') D class(*JAVA:'org.apache.commons.- D httpclient.util.Base64') DtoString PR 32767a extproc(*JAVA:'java.lang.Byte': D 'toString') varying DgetBytes PR 32767a extproc(*JAVA:'java.lang.String': D 'getBytes') varying PdecodeBase64 B Export DdecodeBase64 PI 32767 varying D inputString 32767 const DoutputString S like(decodeBase64) /free stringObject = newString(%trim(inputString)); byteObject = newByteArray(stringObject); base64Class = newBase64Class(); byteObject = decode(byteObject); outPutString = toString(byteObject); return outputString; /end-free P E When calling the constructor for the byteObject, I'm getting a java.lang.NumberFormatException. How do I create a byte array of my Base64 token? Thanks, Mark Mark D. Walter Senior Programmer/Analyst CCX, Inc. mwalter@xxxxxxxxxx http://www.ccxinc.com
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.