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 booleanprivate static MagicParser -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidaddHint(String extension, MagicMatcher matcher) Add a hint to use the specified matcher for the given extensionstatic MagicMatchgetMagicMatch(byte[] data) Get a match from a stream of data.static MagicMatchgetMagicMatch(byte[] data, boolean onlyMimeMatch) Get a match from a stream of data.static voidCreate 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-truepara indicar que sólo se identifique el MimeType de los datos,falseen 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.
-