protected void decodeAtom(PushbackInputStream inStream,OutputStream outStream,int l) throws IOException {
  int i, p1, p2, np1, np2;
  byte a=-1, b=-1, c=-1;
  byte high_byte, low_byte;
  byte tmp[]=new byte[3];
  i=inStream.read(tmp);
  if (i != 3) {
    throw new CEStreamExhausted();
  }
  for (i=0; (i < 64) && ((a == -1) || (b == -1) || (c == -1)); i++) {
    if (tmp[0] == map_array[i]) {
      a=(byte)i;
    }
    if (tmp[1] == map_array[i]) {
      b=(byte)i;
    }
    if (tmp[2] == map_array[i]) {
      c=(byte)i;
    }
  }
  high_byte=(byte)(((a & 0x38) << 2) + (b & 0x1f));
  low_byte=(byte)(((a & 0x7) << 5) + (c & 0x1f));
  p1=0;
  p2=0;
  for (i=1; i < 256; i=i * 2) {
    if ((high_byte & i) != 0)     p1++;
    if ((low_byte & i) != 0)     p2++;
  }
  np1=(b & 32) / 32;
  np2=(c & 32) / 32;
  if ((p1 & 1) != np1) {
    throw new CEFormatException("UCDecoder: High byte parity error.");
  }
  if ((p2 & 1) != np2) {
    throw new CEFormatException("UCDecoder: Low byte parity error.");
  }
  outStream.write(high_byte);
  crc.update(high_byte);
  if (l == 2) {
    outStream.write(low_byte);
    crc.update(low_byte);
  }
}

protected void decodeAtom ( PushbackInputStream inStream , OutputStream outStream , int l ) throws IOException { int i , p1 , p2 , np1 , np2 ; byte a = - 1 , b = - 1 , c = - 1 ; byte high_byte , low_byte ; byte tmp [ ] = new byte [ 3 ] ; i = inStream . read ( tmp ) ; if ( i != 3 ) { throw new CEStreamExhausted ( ) ; } for ( i = 0 ; ( i < 64 ) && ( ( a == - 1 ) || ( b == - 1 ) || ( c == - 1 ) ) ; i ++ ) { if ( tmp [ 0 ] == map_array [ i ] ) { a = ( byte ) i ; } if ( tmp [ 1 ] == map_array [ i ] ) { b = ( byte ) i ; } if ( tmp [ 2 ] == map_array [ i ] ) { c = ( byte ) i ; } } high_byte = ( byte ) ( ( ( a & 0x38 ) << 2 ) + ( b & 0x1f ) ) ; low_byte = ( byte ) ( ( ( a & 0x7 ) << 5 ) + ( c & 0x1f ) ) ; p1 = 0 ; p2 = 0 ; for ( i = 1 ; i < 256 ; i = i * 2 ) { if ( ( high_byte & i ) != 0 ) p1 ++ ; if ( ( low_byte & i ) != 0 ) p2 ++ ; } np1 = ( b & 32 ) / 32 ; np2 = ( c & 32 ) / 32 ; if ( ( p1 & 1 ) != np1 ) { throw new CEFormatException ( "UCDecoder: High byte parity error." ) ; } if ( ( p2 & 1 ) != np2 ) { throw new CEFormatException ( "UCDecoder: Low byte parity error." ) ; } outStream . write ( high_byte ) ; crc . update ( high_byte ) ; if ( l == 2 ) { outStream . write ( low_byte ) ; crc . update ( low_byte ) ; } }
decode one atom - reads the characters from the input stream , decodes them , and checks for valid parity .
