/** * determine if this match or any submatches has the description * * @param desc DOCUMENT ME! * * @return whether or not the description matches */ public boolean mimeTypeMatches(String desc) { if ((mimeType != null) && mimeType.equals(desc)) { return true; } Collection<MagicMatch> submatches = getSubMatches(); Iterator<MagicMatch> i = submatches.iterator(); MagicMatch m = null; while (i.hasNext()) { m = (MagicMatch) i.next(); if (m.mimeTypeMatches(desc)) { return true; } } return false; }
/** * determine if this match or any submatches has the description * * @param desc DOCUMENT ME! * * @return whether or not the description matches */ public boolean descriptionMatches(String desc) { if ((description != null) && description.equals(desc)) { return true; } Collection<MagicMatch> submatches = getSubMatches(); Iterator<MagicMatch> i = submatches.iterator(); MagicMatch m = null; while (i.hasNext()) { m = (MagicMatch) i.next(); if (m.descriptionMatches(desc)) { return true; } } return false; }
/** * determine if this match or any submatches has the description * * @param desc DOCUMENT ME! * * @return whether or not the description matches */ public boolean descriptionMatches(String desc) { if ((description != null) && description.equals(desc)) { return true; } Collection submatches = getSubMatches(); Iterator i = submatches.iterator(); MagicMatch m = null; while (i.hasNext()) { m = (MagicMatch) i.next(); if (m.descriptionMatches(desc)) { return true; } } return false; }
/** * determine if this match or any submatches has the description * * @param desc DOCUMENT ME! * * @return whether or not the description matches */ public boolean mimeTypeMatches(final String desc) { if (this.mimeType != null && this.mimeType.equals(desc)) { return true; } final Collection<MagicMatch> submatches = getSubMatches(); final Iterator<MagicMatch> i = submatches.iterator(); MagicMatch m = null; while (i.hasNext()) { m = i.next(); if (m.mimeTypeMatches(desc)) { return true; } } return false; }
/** * determine if this match or any submatches has the description * * @param desc DOCUMENT ME! * * @return whether or not the description matches */ public boolean mimeTypeMatches(String desc) { if ((mimeType != null) && mimeType.equals(desc)) { return true; } Collection submatches = getSubMatches(); Iterator i = submatches.iterator(); MagicMatch m = null; while (i.hasNext()) { m = (MagicMatch) i.next(); if (m.mimeTypeMatches(desc)) { return true; } } return false; }
/** * determine if this match or any submatches has the description * * @param desc DOCUMENT ME! * * @return whether or not the description matches */ public boolean descriptionMatches(final String desc) { if (this.description != null && this.description.equals(desc)) { return true; } final Collection<MagicMatch> submatches = getSubMatches(); final Iterator<MagicMatch> i = submatches.iterator(); MagicMatch m = null; while (i.hasNext()) { m = i.next(); if (m.descriptionMatches(desc)) { return true; } } return false; }
/** * print a magic match * * @param stream DOCUMENT ME! * @param match DOCUMENT ME! * @param spacing DOCUMENT ME! */ public static void printMagicMatch(PrintStream stream, MagicMatch match, String spacing) { stream.println(spacing + "============================="); stream.println(spacing + "mime type: " + match.getMimeType()); stream.println(spacing + "description: " + match.getDescription()); stream.println(spacing + "extension: " + match.getExtension()); stream.println(spacing + "test: " + new String(match.getTest().array())); stream.println(spacing + "bitmask: " + match.getBitmask()); stream.println(spacing + "offset: " + match.getOffset()); stream.println(spacing + "length: " + match.getLength()); stream.println(spacing + "type: " + match.getType()); stream.println(spacing + "comparator: " + match.getComparator()); stream.println(spacing + "============================="); Collection submatches = match.getSubMatches(); Iterator i = submatches.iterator(); while (i.hasNext()) { printMagicMatch(stream, (MagicMatch) i.next(), spacing + " "); } }
/** * print a magic match * * @param stream DOCUMENT ME! * @param match DOCUMENT ME! * @param spacing DOCUMENT ME! */ public static void printMagicMatch(PrintStream stream, MagicMatch match, String spacing) { stream.println(spacing + "============================="); stream.println(spacing + "mime type: " + match.getMimeType()); stream.println(spacing + "description: " + match.getDescription()); stream.println(spacing + "extension: " + match.getExtension()); stream.println(spacing + "test: " + new String(match.getTest().array())); stream.println(spacing + "bitmask: " + match.getBitmask()); stream.println(spacing + "offset: " + match.getOffset()); stream.println(spacing + "length: " + match.getLength()); stream.println(spacing + "type: " + match.getType()); stream.println(spacing + "comparator: " + match.getComparator()); stream.println(spacing + "============================="); Collection<MagicMatch> submatches = match.getSubMatches(); Iterator<MagicMatch> i = submatches.iterator(); while (i.hasNext()) { printMagicMatch(stream, (MagicMatch) i.next(), spacing + " "); } }