protected void encodeAtom(OutputStream outStream,byte data[],int offset,int len) throws IOException {
  byte a, b=1, c=1;
  int c1, c2, c3, c4;
  a=data[offset];
  if (len > 1) {
    b=data[offset + 1];
  }
  if (len > 2) {
    c=data[offset + 2];
  }
  c1=(a >>> 2) & 0x3f;
  c2=((a << 4) & 0x30) | ((b >>> 4) & 0xf);
  c3=((b << 2) & 0x3c) | ((c >>> 6) & 0x3);
  c4=c & 0x3f;
  outStream.write(c1 + ' ');
  outStream.write(c2 + ' ');
  outStream.write(c3 + ' ');
  outStream.write(c4 + ' ');
  return;
}

protected void encodeAtom ( OutputStream outStream , byte data [ ] , int offset , int len ) throws IOException { byte a , b = 1 , c = 1 ; int c1 , c2 , c3 , c4 ; a = data [ offset ] ; if ( len > 1 ) { b = data [ offset + 1 ] ; } if ( len > 2 ) { c = data [ offset + 2 ] ; } c1 = ( a > > > 2 ) & 0x3f ; c2 = ( ( a << 4 ) & 0x30 ) | ( ( b > > > 4 ) & 0xf ) ; c3 = ( ( b << 2 ) & 0x3c ) | ( ( c > > > 6 ) & 0x3 ) ; c4 = c & 0x3f ; outStream . write ( c1 + ' ' ) ; outStream . write ( c2 + ' ' ) ; outStream . write ( c3 + ' ' ) ; outStream . write ( c4 + ' ' ) ; return ; }
encodeatom - take three bytes and encodes them into 4 characters if len is less than 3 then remaining bytes are filled with ' 1 ' . this insures that the last line won ' t end in spaces and potentiallly be truncated .
