Package net.sf.jmimemagic
Class MagicParser
java.lang.Object
org.xml.sax.helpers.DefaultHandler
net.sf.jmimemagic.MagicParser
- All Implemented Interfaces:
ContentHandler,DTDHandler,EntityResolver,ErrorHandler
Analizador del XML de identificación de tipos de fichero.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Stringprivate booleanprivate booleanprivate booleanprivate booleanprivate booleanprivate static final Stringprivate MagicMatchprivate MagicMatcherprivate final Collection<MagicMatcher> private XMLReaderprivate final ArrayList<MagicMatcher> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcharacters(char[] ch, int offset, int length) private static ByteBufferreplaces octal representations of bytes, written as \ddd to actual byte values.voidvoidendElement(String uri, String localName, String qname) voidvoidDOCUMENT ME!voidignorableWhitespace(char[] ch, int offset, int length) voidParse the xml file and create our MagicMatcher object list.voidprocessingInstruction(String target, String data) voidvoidstartElement(String uri, String localName, String qname, Attributes attributes) voidMethods inherited from class org.xml.sax.helpers.DefaultHandler
endPrefixMapping, notationDecl, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDeclMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.xml.sax.ContentHandler
declaration
-
Field Details
-
MAGIC_FILE
- See Also:
-
initialized
private boolean initialized -
parser
-
stack
-
matchers
-
matcher
-
match
-
properties
-
finalValue
-
isMimeType
private boolean isMimeType -
isExtension
private boolean isExtension -
isDescription
private boolean isDescription -
isTest
private boolean isTest
-
-
Constructor Details
-
MagicParser
public MagicParser()
-
-
Method Details
-
initialize
Parse the xml file and create our MagicMatcher object list.- Throws:
MagicParseException- Cuando falla el análisis de los datos.
-
getMatchers
DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
startDocument
public void startDocument()- Specified by:
startDocumentin interfaceContentHandler- Overrides:
startDocumentin classDefaultHandler
-
endDocument
public void endDocument()- Specified by:
endDocumentin interfaceContentHandler- Overrides:
endDocumentin classDefaultHandler
-
processingInstruction
- Specified by:
processingInstructionin interfaceContentHandler- Overrides:
processingInstructionin classDefaultHandler
-
characters
public void characters(char[] ch, int offset, int length) - Specified by:
charactersin interfaceContentHandler- Overrides:
charactersin classDefaultHandler
-
ignorableWhitespace
public void ignorableWhitespace(char[] ch, int offset, int length) - Specified by:
ignorableWhitespacein interfaceContentHandler- Overrides:
ignorableWhitespacein classDefaultHandler
-
startElement
- Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classDefaultHandler
-
endElement
- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classDefaultHandler
-
warning
- Specified by:
warningin interfaceErrorHandler- Overrides:
warningin classDefaultHandler
-
error
- Specified by:
errorin interfaceErrorHandler- Overrides:
errorin classDefaultHandler- Throws:
SAXException
-
fatalError
- Specified by:
fatalErrorin interfaceErrorHandler- Overrides:
fatalErrorin classDefaultHandler- Throws:
SAXException
-
convertOctals
replaces octal representations of bytes, written as \ddd to actual byte values.- Parameters:
s- a string with encoded octals- Returns:
- string with all octals decoded
-