Package net.sf.jmimemagic
Class Magic
java.lang.Object
net.sf.jmimemagic.Magic
This class is the primary class for jMimeMagic
- Version:
- $Revision: 1.8 $
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static HashMap
<String, ArrayList<MagicMatcher>> private static boolean
private static MagicParser
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static void
addHint
(String extension, MagicMatcher matcher) Add a hint to use the specified matcher for the given extensionstatic MagicMatch
getMagicMatch
(byte[] data) Get a match from a stream of data.static MagicMatch
getMagicMatch
(byte[] data, boolean onlyMimeMatch) Get a match from a stream of data.static void
Create a parser and initialize it.
-
Field Details
-
initialized
private static boolean initialized -
magicParser
-
hintMap
-
-
Constructor Details
-
Magic
public Magic()
-
-
Method Details
-
addHint
Add a hint to use the specified matcher for the given extension- Parameters:
extension
- DOCUMENT ME!matcher
- DOCUMENT ME!
-
initialize
Create a parser and initialize it.- Throws:
MagicParseException
- En cualquier error.
-
getMagicMatch
public static MagicMatch getMagicMatch(byte[] data) throws MagicParseException, MagicMatchNotFoundException, MagicException Get a match from a stream of data.- Parameters:
data
- Data.- Returns:
- Match.
- Throws:
MagicParseException
- Cuando falla la carga de las relaciones.MagicMatchNotFoundException
- Cuando no se identifican los datos.MagicException
- Cuando falla el análisis.
-
getMagicMatch
public static MagicMatch getMagicMatch(byte[] data, boolean onlyMimeMatch) throws MagicParseException, MagicMatchNotFoundException, MagicException Get a match from a stream of data.- Parameters:
data
- Data.onlyMimeMatch
-true
para indicar que sólo se identifique el MimeType de los datos,false
en caso contrario.- Returns:
- Match.
- Throws:
MagicParseException
- Cuando falla la carga de las relaciones.MagicMatchNotFoundException
- Cuando no se identifican los datos.MagicException
- Cuando falla el análisis.
-