protected void encodeAtom(OutputStream outStream,
byte[] data,
int offset,
int len) throws IOException {
byte a, b, c;
if (len == 1) {
a = data[offset];
b = 0;
c = 0;
outStream.write(pem_array[(a > > > 2) & 0x3F]);
outStream.write(pem_array[((a < < 4) & 0x30) + ((b > > > 4) & 0xf)]);
outStream.write('=");
outStream.write('=");
} else if (len == 2) {
a = data[offset];
b = data[offset+1];
c = 0;
outStream.write(pem_array[(a > > > 2) & 0x3F]);
outStream.write(pem_array[((a < < 4) & 0x30) + ((b > > > 4) & 0xf)]);
outStream.write(pem_array[((b < < 2) & 0x3c) + ((c > > > 6) & 0x3)]);
outStream.write('=");
} else {
a = data[offset];
b = data[offset+1];
c = data[offset+2];
outStream.write(pem_array[(a > > > 2) & 0x3F]);
outStream.write(pem_array[((a < < 4) & 0x30) + ((b > > > 4) & 0xf)]);
outStream.write(pem_array[((b < < 2) & 0x3c) + ((c > > > 6) & 0x3)]);
outStream.write(pem_array[c & 0x3F]);
}
}
encodeAtom - Take three bytes of input and encode it as 4
printable characters. Note that if the length in len is less
than three is encodes either one or two '=' signs to indicate
padding characters. |