public static Value convert_uuencode(StringValue source)
{
if (source.length() == 0)
return BooleanValue.FALSE;
StringValue result = source.createStringBuilder();
int i = 0;
int length = source.length();
while (i < length) {
int sublen = length - i;
if (45 < sublen)
sublen = 45;
result.append((char) (sublen + 0x20));
int end = i + sublen;
while (i < end) {
int code = source.charAt(i++) << 16;
if (i < length)
code += source.charAt(i++) << 8;
if (i < length)
code += source.charAt(i++);
result.append(toUUChar(((code >> 18) & 0x3f)));
result.append(toUUChar(((code >> 12) & 0x3f)));
result.append(toUUChar(((code >> 6) & 0x3f)));
result.append(toUUChar(((code) & 0x3f)));
}
result.append('\n');
}
result.append((char) 0x60);
result.append('\n');
return result;
}