Tabnine Logo
Magic.printMagicMatch
Code IndexAdd Tabnine to your IDE (free)

How to use
printMagicMatch
method
in
net.sf.jmimemagic.Magic

Best Java code snippets using net.sf.jmimemagic.Magic.printMagicMatch (Showing top 4 results out of 315)

origin: arimus/jmimemagic

  /**
   * DOCUMENT ME!
   *
   * @param args DOCUMENT ME!
   */
  public static void main(String[] args)
  {
    try {
      if (args.length == 0) {
        System.err.println("usage: test <file>");
        System.exit(1);;
      }
      File f = new File(args[0]);

      if (f.exists()) {
        MagicMatch match = Magic.getMagicMatch(f, true, false);

        System.out.println("filename: " + args[0]);
        printMagicMatch(System.out, match, "");
      } else {
        System.err.println("file '" + f.getCanonicalPath() + "' not found");
      }
    } catch (MagicMatchNotFoundException e) {
      System.out.println("no match found");
    } catch (Exception e) {
      System.err.println("error: " + e);
      e.printStackTrace(System.err);
    }
  }
}
origin: jmimemagic/jmimemagic

printMagicMatch(System.out, match, "");
origin: jmimemagic/jmimemagic

/**
 * 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 + "    ");
  }
}
origin: arimus/jmimemagic

/**
 * 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 + "    ");
  }
}
net.sf.jmimemagicMagicprintMagicMatch

Javadoc

print a magic match

Popular methods of Magic

  • getMagicMatch
    get a match from a stream of data
  • addHint
    Add a hint to use the specified matcher for the given extension
  • initialize
    create a parser and initialize it
  • getMatchers
    return the parsed MagicMatch objects that were created from the magic.xml definitions
  • printMagicMatcher
    print a magic match

Popular in Java

  • Creating JSON documents from java classes using gson
  • onRequestPermissionsResult (Fragment)
  • requestLocationUpdates (LocationManager)
  • getSharedPreferences (Context)
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • Option (scala)
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now