common/src/main/java/HTTPClient/Codecs.java
/**
     * This method decodes the given uuencoded char[].
     *
     * <P><em>Note:</em> just the actual data is decoded; any 'begin' and
     * 'end' lines such as those generated by the unix <code>uuencode</code>
     * utility must not be included.
     *
     * @param  data the uuencode-encoded data.
     * @return the decoded <var>data</var>.
     */
This method decodes the given uuencoded char[].
Note: just the actual data is decoded; any 'begin' and
'end' lines such as those generated by the unix uuencode
utility must not be included.

@param  data the uuencode-encoded data.
@return the decoded data.
This method decodes the given uuencoded char [] . Note : just the actual data is decoded ; any ' begin ' and ' end ' lines such as those generated by the unix uuencode utility must not be included . @param data the uuencode - encoded data . @return the decoded data .
public final static byte[] uudecode(char[] data)
    {
	if (data == null)  return  null;
	int sidx, didx;
	byte dest[] = new byte[data.length/4*3];
	for (sidx=0, didx=0; sidx < data.length; )
	{
	    int len = UUDecMap[data[sidx++]];
	    int end = didx+len;
	    for (; didx < end-2; sidx += 4)
	    {
		byte A = UUDecMap[data[sidx]],
		     B = UUDecMap[data[sidx+1]],
		     C = UUDecMap[data[sidx+2]],
		     D = UUDecMap[data[sidx+3]];
		dest[didx++] = (byte) ( ((A << 2) & 255) | ((B >>> 4) & 003) );
		dest[didx++] = (byte) ( ((B << 4) & 255) | ((C >>> 2) & 017) );
		dest[didx++] = (byte) ( ((C << 6) & 255) | (D & 077) );
	    }
	    if (didx < end)
	    {
		byte A = UUDecMap[data[sidx]],
		     B = UUDecMap[data[sidx+1]];
		dest[didx++] = (byte) ( ((A << 2) & 255) | ((B >>> 4) & 003) );
	    }
	    if (didx < end)
	    {
		byte B = UUDecMap[data[sidx+1]],
		     C = UUDecMap[data[sidx+2]];
		dest[didx++] = (byte) ( ((B << 4) & 255) | ((C >>> 2) & 017) );
	    }
	    while (sidx < data.length  &&
		   data[sidx] != '\n'  &&  data[sidx] != '\r')
		sidx++;
	    while (sidx < data.length  &&
		   (data[sidx] == '\n'  ||  data[sidx] == '\r'))
		sidx++;
	}
	return Util.resizeArray(dest, didx);
    }
public final static byte [ ] uudecode ( char [ ] data ) { if ( data == null ) return null ; int sidx , didx ; byte dest [ ] = new byte [ data . length / 4 * 3 ] ; for ( sidx = 0 , didx = 0 ; sidx < data . length ; ) { int len = UUDecMap [ data [ sidx ++ ] ] ; int end = didx + len ; for ( ; didx < end - 2 ; sidx += 4 ) { byte A = UUDecMap [ data [ sidx ] ] , B = UUDecMap [ data [ sidx + 1 ] ] , C = UUDecMap [ data [ sidx + 2 ] ] , D = UUDecMap [ data [ sidx + 3 ] ] ; dest [ didx ++ ] = ( byte ) ( ( ( A << 2 ) & 255 ) | ( ( B >>> 4 ) & 003 ) ) ; dest [ didx ++ ] = ( byte ) ( ( ( B << 4 ) & 255 ) | ( ( C >>> 2 ) & 017 ) ) ; dest [ didx ++ ] = ( byte ) ( ( ( C << 6 ) & 255 ) | ( D & 077 ) ) ; } if ( didx < end ) { byte A = UUDecMap [ data [ sidx ] ] , B = UUDecMap [ data [ sidx + 1 ] ] ; dest [ didx ++ ] = ( byte ) ( ( ( A << 2 ) & 255 ) | ( ( B >>> 4 ) & 003 ) ) ; } if ( didx < end ) { byte B = UUDecMap [ data [ sidx + 1 ] ] , C = UUDecMap [ data [ sidx + 2 ] ] ; dest [ didx ++ ] = ( byte ) ( ( ( B << 4 ) & 255 ) | ( ( C >>> 2 ) & 017 ) ) ; } while ( sidx < data . length && data [ sidx ] != '\n' && data [ sidx ] != '\r' ) sidx ++ ; while ( sidx < data . length && ( data [ sidx ] == '\n' || data [ sidx ] == '\r' ) ) sidx ++ ; } return Util . resizeArray ( dest , didx ) ; }
This method decodes the given uuencoded char[].
This method decodes the given uuencoded char [] .
// get line length (in number of encoded octets) // ascii printable to 0-63 and 4-byte to 3-byte conversion // skip padding // skip end of line