org.apache.cocoon.serialization
Class XMidiSerializer

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.xml.AbstractXMLProducer
          extended by org.apache.cocoon.xml.AbstractXMLPipe
              extended by org.apache.cocoon.serialization.AbstractSerializer
                  extended by org.apache.cocoon.serialization.XMidiSerializer
All Implemented Interfaces:
Poolable, Recyclable, Component, LogEnabled, Serializer, SitemapOutputComponent, XMLPipe, XMLProducer, XMLConsumer, ContentHandler, LexicalHandler

public class XMidiSerializer
extends AbstractSerializer

Takes SAX Events and serializes them as a standard MIDI file. The MIDI file generation parts of this class are based on code from the XMidi project, written by Peter Arthur Loeb (http://www.palserv.com/XMidi/) and used with permission. The warranty disclaimer of the MIT license (http://www.opensource.org/licenses/mit-license.html) applies to Peter Arthur Loeb's code.

Version:
CVS $Id: XMidiSerializer.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Mark Leicester, Peter Loeb

Field Summary
 
Fields inherited from class org.apache.cocoon.serialization.AbstractSerializer
output
 
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
 
Fields inherited from interface org.apache.cocoon.serialization.Serializer
ROLE
 
Constructor Summary
XMidiSerializer()
           
 
Method Summary
 void characters(char[] str, int arg1, int arg2)
          Receive notification of character data.
 void endElement(String namespaceURI, String localName, String qName)
          Receive notification of the end of an element.
 String getMimeType()
          Get the mime-type of the output of this Serializer
 void recycle()
          Recycle serializer by removing references
 void startElement(String namespaceURI, String localName, String qName, Attributes atts)
          Receive notification of the beginning of an element.
 
Methods inherited from class org.apache.cocoon.serialization.AbstractSerializer
setOutputStream, shouldSetContentLength
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLPipe
comment, endCDATA, endDocument, endDTD, endEntity, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startCDATA, startDocument, startDTD, startEntity, startPrefixMapping
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
setConsumer, setContentHandler, setLexicalHandler
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
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.ContentHandler
endDocument, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping
 
Methods inherited from interface org.xml.sax.ext.LexicalHandler
comment, endCDATA, endDTD, endEntity, startCDATA, startDTD, startEntity
 
Methods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
 

Constructor Detail

XMidiSerializer

public XMidiSerializer()
Method Detail

recycle

public void recycle()
Description copied from class: AbstractSerializer
Recycle serializer by removing references

Specified by:
recycle in interface Recyclable
Overrides:
recycle in class AbstractSerializer

getMimeType

public String getMimeType()
Description copied from class: AbstractSerializer
Get the mime-type of the output of this Serializer

Specified by:
getMimeType in interface SitemapOutputComponent
Overrides:
getMimeType in class AbstractSerializer
See Also:
AbstractProcessingPipeline.setMimeTypeForSerializer(org.apache.cocoon.environment.Environment), AbstractProcessingPipeline.setMimeTypeForReader(org.apache.cocoon.environment.Environment)

startElement

public void startElement(String namespaceURI,
                         String localName,
                         String qName,
                         Attributes atts)
                  throws SAXException
Description copied from class: AbstractXMLPipe
Receive notification of the beginning of an element.

Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class AbstractXMLPipe
Parameters:
namespaceURI - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
localName - The local name (without prefix), or the empty string if Namespace processing is not being performed.
qName - The raw XML 1.0 name (with prefix), or the empty string if raw names are not available.
atts - The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.
Throws:
SAXException

endElement

public void endElement(String namespaceURI,
                       String localName,
                       String qName)
                throws SAXException
Description copied from class: AbstractXMLPipe
Receive notification of the end of an element.

Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class AbstractXMLPipe
Parameters:
namespaceURI - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
localName - The local name (without prefix), or the empty string if Namespace processing is not being performed.
qName - The raw XML 1.0 name (with prefix), or the empty string if raw names are not available.
Throws:
SAXException

characters

public void characters(char[] str,
                       int arg1,
                       int arg2)
                throws SAXException
Description copied from class: AbstractXMLPipe
Receive notification of character data.

Specified by:
characters in interface ContentHandler
Overrides:
characters in class AbstractXMLPipe
Parameters:
str - The characters from the XML document.
arg1 - The start position in the array.
arg2 - The number of characters to read from the array.
Throws:
SAXException


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.