Mitsubishi Electric Melsec Q Series User Manual page 341

Programmable contoller mes interface module
Hide thumbs Also See for Melsec Q Series:
Table of Contents

Advertisement

9
XML MESSAGE FORMAT
//Base64 encode
static String encodeBase64(String inStr) {
String refTable = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
int rest = inStr.length()%3;
if ( rest != 0)
inStr += new String(new byte[] {0, 0, 0}).substring(rest);
byte[] inBuf = inStr.getBytes();
StringBuffer outStr = new StringBuffer();
for (int i = 0; i < inBuf.length; i+= 3) {
int tempBuf = inBuf[i]<<16 | inBuf[i+1]<<8 | inBuf[i+2];
for (int j = 18; j >= 0; j - = 6)
outStr.append(refTable.charAt((tempBuf >> j) & 0x3f));
}
if (rest != 0) {
outStr.delete(outStr.length() - 3 + rest, outStr.length());
outStr.append("===".substring(rest));
}
return new String(outStr);
}
}
9.2 XML Message Format Sending Method
9.2.2 Sample program
(From the previous page)
9
- 6
9
10

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Qj71mes96Qj71mes96nSw1dnc-mesif-e

Table of Contents