|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.xml.sax.helpers.XMLFilterImpl | +--org.esau.ptarmigan.impl.GeneratorImpl
GeneratorImpl
From which the source is identified and which the parsers are launched
Instances of this class parse media files of different formats (mp3, ogg, pls, etc.) and generate SAX events describing the metadata of those files which can then be consumed, such as for data storage.
Those SAX events are typically used to build a Document which in turn is transformed to an object useable by the caller.
IMPLEMENTATION DETAILS
The algorithm used is designed for one-pass usage. It requires the use of a buffered stream where a marker can be set to sniff ahead for tags.
One at a time, give each parser a chance to sniff that buffer. The first one who returns sniff==true will own that position and immediately can parse data from it up to a limit.
NOTES
TODO: remove all references to specific parsers from the GeneratorImpl. Instead refer to them dynamically through StreamParser (ID3v2, Vorbis, etc.) and FileParser (ID3v1) interfaces. Place each parser in a jar and use a resource reference to identify it as a client parser.
Fields inherited from interface org.esau.ptarmigan.Generator |
DEFAULT_INCLUDE_DIGEST, DEFAULT_INCLUDE_PLAYLIST_ENTRIES, DEFAULT_PROPERTY_READ_LIMIT, FEATURE_INCLUDE_DIGEST, FEATURE_INCLUDE_PLAYLIST_ENTRIES, PROPERTY_READ_LIMIT |
Constructor Summary | |
GeneratorImpl()
|
Method Summary | |
boolean |
getFeature(java.lang.String name)
OVERRIDE Look up the value of a feature. |
java.lang.Object |
getProperty(java.lang.String name)
OVERRIDE Look up the value of a property. |
void |
parse(org.xml.sax.InputSource input)
OVERRIDE SAX-invoked parse If it's a file, attempt to parse the ID3v1 tag at the end of the file. |
void |
resetData()
Reset data members for reuse |
void |
setContentHandler(org.xml.sax.ContentHandler handler)
OVERRIDE Set the content event handler. |
void |
setFeature(java.lang.String name,
boolean value)
OVERRIDE Set the value of a feature. |
void |
setProperty(java.lang.String name,
java.lang.Object value)
OVERRIDE Set the value of a property. |
Methods inherited from class org.xml.sax.helpers.XMLFilterImpl |
characters, endDocument, endElement, endPrefixMapping, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getParent, ignorableWhitespace, notationDecl, parse, processingInstruction, resolveEntity, setDocumentLocator, setDTDHandler, setEntityResolver, setErrorHandler, setParent, skippedEntity, startDocument, startElement, startPrefixMapping, unparsedEntityDecl, warning |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.xml.sax.XMLFilter |
getParent, setParent |
Methods inherited from interface org.xml.sax.XMLReader |
getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, parse, setDTDHandler, setEntityResolver, setErrorHandler |
Methods inherited from interface org.xml.sax.ContentHandler |
characters, endDocument, endElement, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping |
Constructor Detail |
public GeneratorImpl()
Method Detail |
public void parse(org.xml.sax.InputSource input) throws java.io.IOException, org.xml.sax.SAXException
parse
in interface org.xml.sax.XMLReader
parse
in class org.xml.sax.helpers.XMLFilterImpl
public void resetData()
Note that features and properties are NOT reset to defaults as they are usually set when the generator is created.
resetData
in interface Generator
public void setContentHandler(org.xml.sax.ContentHandler handler)
setContentHandler
in interface org.xml.sax.XMLReader
setContentHandler
in class org.xml.sax.helpers.XMLFilterImpl
public boolean getFeature(java.lang.String name) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
getFeature
in interface org.xml.sax.XMLReader
getFeature
in class org.xml.sax.helpers.XMLFilterImpl
public void setFeature(java.lang.String name, boolean value) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
setFeature
in interface org.xml.sax.XMLReader
setFeature
in class org.xml.sax.helpers.XMLFilterImpl
public java.lang.Object getProperty(java.lang.String name) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
getProperty
in interface org.xml.sax.XMLReader
getProperty
in class org.xml.sax.helpers.XMLFilterImpl
public void setProperty(java.lang.String name, java.lang.Object value) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
setProperty
in interface org.xml.sax.XMLReader
setProperty
in class org.xml.sax.helpers.XMLFilterImpl
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |