congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
Magic.initialize
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: jmimemagic/jmimemagic

/**
 * print the contents of a magic file
 *
 * @param stream DOCUMENT ME!
 *
 * @throws MagicParseException DOCUMENT ME!
 */
public static void printMagicFile(PrintStream stream)
  throws MagicParseException
{
  if (!initialized) {
    initialize();
  }
  Collection matchers = Magic.getMatchers();
  log.debug("have " + matchers.size() + " matches");
  MagicMatcher matcher = null;
  Iterator i = matchers.iterator();
  while (i.hasNext()) {
    matcher = (MagicMatcher) i.next();
    log.debug("printing");
    printMagicMatcher(stream, matcher, "");
  }
}
origin: arimus/jmimemagic

/**
 * print the contents of a magic file
 *
 * @param stream DOCUMENT ME!
 *
 * @throws MagicParseException DOCUMENT ME!
 */
public static void printMagicFile(PrintStream stream)
  throws MagicParseException
{
  if (!initialized) {
    initialize();
  }
  Collection<MagicMatcher> matchers = Magic.getMatchers();
  log.debug("have " + matchers.size() + " matches");
  MagicMatcher matcher = null;
  Iterator<MagicMatcher> i = matchers.iterator();
  while (i.hasNext()) {
    matcher = (MagicMatcher) i.next();
    log.debug("printing");
    printMagicMatcher(stream, matcher, "");
  }
}
origin: jmimemagic/jmimemagic

/**
 * return the parsed MagicMatch objects that were created from the magic.xml
 * definitions
 *
 * @return the parsed MagicMatch objects
 *
 * @throws MagicParseException DOCUMENT ME!
 */
public static Collection getMatchers()
  throws MagicParseException
{
  log.debug("getMatchers()");
  if (!initialized) {
    initialize();
  }
  Iterator i = magicParser.getMatchers().iterator();
  ArrayList m = new ArrayList();
  while (i.hasNext()) {
    MagicMatcher matcher = (MagicMatcher) i.next();
    try {
      m.add(matcher.clone());
    } catch (CloneNotSupportedException e) {
      log.error("failed to clone matchers");
      throw new MagicParseException("failed to clone matchers");
    }
  }
  return m;
}
origin: arimus/jmimemagic

/**
 * return the parsed MagicMatch objects that were created from the magic.xml
 * definitions
 *
 * @return the parsed MagicMatch objects
 *
 * @throws MagicParseException DOCUMENT ME!
 */
public static Collection<MagicMatcher> getMatchers()
  throws MagicParseException
{
  log.debug("getMatchers()");
  if (!initialized) {
    initialize();
  }
  Iterator<MagicMatcher> i = magicParser.getMatchers().iterator();
  List<MagicMatcher> m = new ArrayList<MagicMatcher>();
  while (i.hasNext()) {
    MagicMatcher matcher = (MagicMatcher) i.next();
    try {
      m.add(matcher.clone());
    } catch (CloneNotSupportedException e) {
      log.error("failed to clone matchers");
      throw new MagicParseException("failed to clone matchers");
    }
  }
  return m;
}
origin: es.gob.afirma.lib/afirma-lib-jmimemagic

  /** Get a match from a stream of data. */
  public static MagicMatch getMagicMatch(final byte[] data,
                      final boolean onlyMimeMatch) throws MagicParseException,
                                        MagicMatchNotFoundException,
                                        MagicException {
    if (!initialized) {
      initialize();
    }

    final Collection<MagicMatcher> matchers = magicParser.getMatchers();

    MagicMatcher matcher = null;
    MagicMatch match = null;
    final Iterator<MagicMatcher> i = matchers.iterator();

    while (i.hasNext()) {
      matcher = i.next();
      try {
        if ((match = matcher.test(data, onlyMimeMatch)) != null) {
          return match;
        }
      }
      catch (final Throwable e) {
        throw new MagicException(e);
      }
    }
    throw new MagicMatchNotFoundException();
  }
}
origin: jmimemagic/jmimemagic

initialize();
origin: arimus/jmimemagic

initialize();
origin: arimus/jmimemagic

initialize();
origin: jmimemagic/jmimemagic

initialize();
net.sf.jmimemagicMagicinitialize

Javadoc

create a parser and initialize it

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
  • getMatchers
    return the parsed MagicMatch objects that were created from the magic.xml definitions
  • printMagicMatch
    print a magic match
  • printMagicMatcher
    print a magic match

Popular in Java

  • Making http requests using okhttp
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getResourceAsStream (ClassLoader)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • JPanel (javax.swing)
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • 21 Best IntelliJ Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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