private static boolean compareLineWithTemplate(String out, String cmp) {
        if (out.length() != cmp.length()) {
            return false;
        }
        StringCharacterIterator outi = new StringCharacterIterator(out);
        StringCharacterIterator cmpi = new StringCharacterIterator(cmp);
        for (outi.first(), cmpi.first();
             outi.current() != CharacterIterator.DONE;
             outi.next(), cmpi.next()) {
            if (cmpi.current() != '*' && outi.current() != cmpi.current()) {
                return false;
            }
        }
        return true;
    }