library/src/main/java/com/qiniu/android/dns/local/DnsMessage.java
private static String readName(DataInputStream dis, byte data[])
            throws IOException {
        int c = dis.readUnsignedByte();
        if ((c & 0xc0) == 0xc0) {
            c = ((c & 0x3f) << 8) + dis.readUnsignedByte();
            HashSet<Integer> jumps = new HashSet<Integer>();
            jumps.add(c);
            return readName(data, c, jumps);
        }
        if (c == 0) {
            return "";
        }
        byte b[] = new byte[c];
        dis.readFully(b);
        String s = IDN.toUnicode(new String(b));
        String t = readName(dis, data);
        if (t.length() > 0) {
            s = s + "." + t;
        }
        return s;
    }
private static String readName(DataInputStream dis, byte data[])
            throws IOException {
        int c = dis.readUnsignedByte();
        if ((c & 0xc0) == 0xc0) {
            c = ((c & 0x3f) << 8) + dis.readUnsignedByte();
            HashSet<Integer> jumps = new HashSet<Integer>();
            jumps.add(c);
            return readName(data, c, jumps);
        }
        if (c == 0) {
            return "";
        }
        byte b[] = new byte[c];
        dis.readFully(b);
        String s = IDN.toUnicode(new String(b));
        String t = readName(dis, data);
        if (t.length() > 0) {
            s = s + "." + t;
        }
        return s;
    }
private static String readName ( DataInputStream dis , byte data [ ] ) throws IOException { int c = dis . readUnsignedByte ( ) ; if ( ( c & 0xc0 ) == 0xc0 ) { c = ( ( c & 0x3f ) << 8 ) + dis . readUnsignedByte ( ) ; HashSet < Integer > jumps = new HashSet < Integer > ( ) ; jumps . add ( c ) ; return readName ( data , c , jumps ) ; } if ( c == 0 ) { return "" ; } byte b [ ] = new byte [ c ] ; dis . readFully ( b ) ; String s = IDN . toUnicode ( new String ( b ) ) ; String t = readName ( dis , data ) ; if ( t . length ( ) > 0 ) { s = s + "." + t ; } return s ; }
Parse a domain name starting at the current offset and moving the input
stream pointer past this domain name (even if cross references occure).

@param dis  The input stream.
@param data The raw data (for cross references).
@return The domain name string.
@throws IOException Should never happen.
Parse a domain name starting at the current offset and moving the input stream pointer past this domain name ( even if cross references occure ) .