Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.esau.ptarmigan.impl.filter
Class BaseFilter  view BaseFilter download BaseFilter.java

java.lang.Object
  extended byorg.xml.sax.helpers.XMLFilterImpl
      extended byorg.esau.ptarmigan.impl.filter.BaseFilter
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler, org.xml.sax.XMLFilter, org.xml.sax.XMLReader
Direct Known Subclasses:
BinaryFilter, PlaylistFilter

public abstract class BaseFilter
extends org.xml.sax.helpers.XMLFilterImpl

BaseFilter -- abstract filter with a few services

TODO: how should in_chars be handled?

Version:
$Revision: 1.4 $ $Date: 2002/10/02 05:27:49 $

Field Summary
(package private) static org.xml.sax.Attributes EMPTY_ATTRS
           
(package private) static org.apache.commons.logging.Log log
          logging object
private  java.lang.StringBuffer m_chars
           
private  boolean m_in_chars
           
(package private)  org.esau.ptarmigan.impl.MediaProperties m_media_properties
           
 
Fields inherited from class org.xml.sax.helpers.XMLFilterImpl
 
Constructor Summary
BaseFilter()
           
 
Method Summary
 void characters(char[] ch, int start, int length)
          Receive notification of character data.
(package private) abstract  void doParse(java.io.InputStream is)
           
(package private)  java.io.InputStream getByteStream(java.lang.String system_id)
          Obtain a byte stream for the specified system_id
(package private)  java.lang.String getChars()
          if using an upstream XML source, obtain the contents of the character buffer, setting it to zero
 org.esau.ptarmigan.impl.MediaProperties getMediaProperties()
           
(package private) abstract  java.lang.String getNamespacePrefix()
           
(package private) abstract  java.lang.String getNamespaceURI()
           
 void parse(org.xml.sax.InputSource input)
          SAX-Invoked parse of a 'document' from an input stream.
 void setMediaProperties(org.esau.ptarmigan.impl.MediaProperties media_properties)
           
(package private)  boolean sourceIsXML()
          indicate whether an XML parser is required to read the source
(package private)  void write(java.lang.String local_name, boolean b)
           
(package private)  void write(java.lang.String local_name, java.util.Iterator it)
           
(package private)  void write(java.lang.String local_name, long value)
           
(package private)  void write(java.lang.String local_name, java.lang.String value)
           
(package private)  void write(java.lang.String ns_uri, java.lang.String ns_prefix, java.lang.String local_name, boolean value)
           
(package private)  void write(java.lang.String ns_uri, java.lang.String ns_prefix, java.lang.String local_name, byte[] bytes, int offset, int length, java.lang.String enc)
           
(package private)  void write(java.lang.String ns_uri, java.lang.String ns_prefix, java.lang.String local_name, java.util.Date date, boolean date_only)
           
(package private)  void write(java.lang.String ns_uri, java.lang.String ns_prefix, java.lang.String local_name, java.util.Iterator it)
           
(package private)  void write(java.lang.String ns_uri, java.lang.String ns_prefix, java.lang.String local_name, long value)
           
(package private)  void write(java.lang.String ns_uri, java.lang.String ns_prefix, java.lang.String local_name, java.lang.String value)
           
(package private)  void write(java.lang.String ns_uri, java.lang.String ns_prefix, java.lang.String local_name, java.lang.String value, org.xml.sax.Attributes attrs)
          leaf writer
(package private)  void writeDate(org.esau.ptarmigan.util.MultiMap map, java.lang.String key, int limit)
           
(package private)  void writeDate(java.lang.String ns_uri, java.lang.String ns_prefix, java.util.Map map, java.lang.String key)
          write an element keyed from the specified map as a xsd:date (or xsd:gYear) element
(package private)  void writeDate(java.lang.String ns_uri, java.lang.String ns_prefix, org.esau.ptarmigan.util.MultiMap content_map, java.lang.String key, int limit)
          write elements for key found in the map as date values
(package private)  void writeDate(java.lang.String ns_uri, java.lang.String ns_prefix, java.lang.String key, java.lang.Object value)
          output the specified value as an [xsd:date] (or key-year [xsd:gYear]) element
(package private)  void writeInteger(java.util.Map map, java.lang.String key)
           
(package private)  void writeInteger(org.esau.ptarmigan.util.MultiMap map, java.lang.String key, int limit)
           
(package private)  void writeInteger(java.lang.String ns_uri, java.lang.String ns_prefix, java.util.Map map, java.lang.String key)
          write an element keyed from the specified map as an integer element
(package private)  void writeInteger(java.lang.String ns_uri, java.lang.String ns_prefix, org.esau.ptarmigan.util.MultiMap content_map, java.lang.String key, int limit)
          write elements for key found in the map as integer values
(package private)  void writeInteger(java.lang.String ns_uri, java.lang.String ns_prefix, java.lang.String key, java.lang.Object value)
          output the specified value as an integer element
(package private)  void writeString(java.util.Map map, java.lang.String key)
           
(package private)  void writeString(org.esau.ptarmigan.util.MultiMap map, java.lang.String key, int limit)
           
(package private)  void writeString(java.lang.String ns_uri, java.lang.String ns_prefix, java.util.Map map, java.lang.String key)
          write an element keyed from the specified map
(package private)  void writeString(java.lang.String ns_uri, java.lang.String ns_prefix, org.esau.ptarmigan.util.MultiMap content_map, java.lang.String key, int limit)
          write elements for key found in the map as string values
(package private)  void writeString(java.lang.String ns_uri, java.lang.String ns_prefix, java.lang.String key, java.lang.Object value)
          output the specified value as an xsd:string element
 
Methods inherited from class org.xml.sax.helpers.XMLFilterImpl
endDocument, endElement, endPrefixMapping, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, getProperty, ignorableWhitespace, notationDecl, parse, processingInstruction, resolveEntity, setContentHandler, setDocumentLocator, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, setProperty, skippedEntity, startDocument, startElement, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_chars

private java.lang.StringBuffer m_chars

m_in_chars

private boolean m_in_chars

m_media_properties

org.esau.ptarmigan.impl.MediaProperties m_media_properties

EMPTY_ATTRS

static final org.xml.sax.Attributes EMPTY_ATTRS

log

static org.apache.commons.logging.Log log
logging object

Constructor Detail

BaseFilter

public BaseFilter()
           throws org.xml.sax.SAXException
Method Detail

sourceIsXML

boolean sourceIsXML()
indicate whether an XML parser is required to read the source


getNamespaceURI

abstract java.lang.String getNamespaceURI()

getNamespacePrefix

abstract java.lang.String getNamespacePrefix()

doParse

abstract void doParse(java.io.InputStream is)
               throws org.xml.sax.SAXException,
                      java.io.IOException,
                      java.text.ParseException

getMediaProperties

public org.esau.ptarmigan.impl.MediaProperties getMediaProperties()

setMediaProperties

public void setMediaProperties(org.esau.ptarmigan.impl.MediaProperties media_properties)

getByteStream

java.io.InputStream getByteStream(java.lang.String system_id)
                            throws java.io.IOException,
                                   org.xml.sax.SAXException
Obtain a byte stream for the specified system_id

Typically used for File-oriented parsers requiring random access but which can deliver a byte stream. (e.g., ID3v1Filter)

TODO: look at trying to open system_id here.


parse

public void parse(org.xml.sax.InputSource input)
           throws org.xml.sax.SAXException,
                  java.io.IOException
SAX-Invoked parse of a 'document' from an input stream.

This module creates the document from the parsed metadata.


characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Receive notification of character data. If upstream XML, just ignore all character SAX events, as we are cacheing them here in a StringBuffer for extraction during the endElements. See ASXFilter or B4SFilter for examples. However, if NOT upstream XML, then pass-thru the character SAX events, as they are needed when temporarily attaching ContentHandlers. Example: Vorbis comments in FLAC tags.


getChars

java.lang.String getChars()
if using an upstream XML source, obtain the contents of the character buffer, setting it to zero


write

void write(java.lang.String ns_uri,
           java.lang.String ns_prefix,
           java.lang.String local_name,
           java.lang.String value,
           org.xml.sax.Attributes attrs)
     throws org.xml.sax.SAXException
leaf writer


write

void write(java.lang.String ns_uri,
           java.lang.String ns_prefix,
           java.lang.String local_name,
           java.lang.String value)
     throws org.xml.sax.SAXException

write

void write(java.lang.String ns_uri,
           java.lang.String ns_prefix,
           java.lang.String local_name,
           byte[] bytes,
           int offset,
           int length,
           java.lang.String enc)
     throws org.xml.sax.SAXException,
            java.io.UnsupportedEncodingException

write

void write(java.lang.String ns_uri,
           java.lang.String ns_prefix,
           java.lang.String local_name,
           long value)
     throws org.xml.sax.SAXException

write

void write(java.lang.String ns_uri,
           java.lang.String ns_prefix,
           java.lang.String local_name,
           java.util.Date date,
           boolean date_only)
     throws org.xml.sax.SAXException

write

void write(java.lang.String ns_uri,
           java.lang.String ns_prefix,
           java.lang.String local_name,
           java.util.Iterator it)
     throws org.xml.sax.SAXException

write

void write(java.lang.String ns_uri,
           java.lang.String ns_prefix,
           java.lang.String local_name,
           boolean value)
     throws org.xml.sax.SAXException

write

void write(java.lang.String local_name,
           java.lang.String value)
     throws org.xml.sax.SAXException

write

void write(java.lang.String local_name,
           long value)
     throws org.xml.sax.SAXException

write

void write(java.lang.String local_name,
           java.util.Iterator it)
     throws org.xml.sax.SAXException

write

void write(java.lang.String local_name,
           boolean b)
     throws org.xml.sax.SAXException

writeString

void writeString(java.lang.String ns_uri,
                 java.lang.String ns_prefix,
                 java.lang.String key,
                 java.lang.Object value)
           throws org.xml.sax.SAXException
output the specified value as an xsd:string element


writeInteger

void writeInteger(java.lang.String ns_uri,
                  java.lang.String ns_prefix,
                  java.lang.String key,
                  java.lang.Object value)
            throws org.xml.sax.SAXException
output the specified value as an integer element


writeDate

void writeDate(java.lang.String ns_uri,
               java.lang.String ns_prefix,
               java.lang.String key,
               java.lang.Object value)
         throws org.xml.sax.SAXException
output the specified value as an [xsd:date] (or key-year [xsd:gYear]) element


writeString

void writeString(java.lang.String ns_uri,
                 java.lang.String ns_prefix,
                 java.util.Map map,
                 java.lang.String key)
           throws org.xml.sax.SAXException
write an element keyed from the specified map


writeInteger

void writeInteger(java.lang.String ns_uri,
                  java.lang.String ns_prefix,
                  java.util.Map map,
                  java.lang.String key)
            throws org.xml.sax.SAXException
write an element keyed from the specified map as an integer element


writeDate

void writeDate(java.lang.String ns_uri,
               java.lang.String ns_prefix,
               java.util.Map map,
               java.lang.String key)
         throws org.xml.sax.SAXException
write an element keyed from the specified map as a xsd:date (or xsd:gYear) element


writeInteger

void writeInteger(java.util.Map map,
                  java.lang.String key)
            throws org.xml.sax.SAXException

writeString

void writeString(java.util.Map map,
                 java.lang.String key)
           throws org.xml.sax.SAXException

writeString

void writeString(java.lang.String ns_uri,
                 java.lang.String ns_prefix,
                 org.esau.ptarmigan.util.MultiMap content_map,
                 java.lang.String key,
                 int limit)
           throws org.xml.sax.SAXException
write elements for key found in the map as string values


writeInteger

void writeInteger(java.lang.String ns_uri,
                  java.lang.String ns_prefix,
                  org.esau.ptarmigan.util.MultiMap content_map,
                  java.lang.String key,
                  int limit)
            throws org.xml.sax.SAXException
write elements for key found in the map as integer values


writeDate

void writeDate(java.lang.String ns_uri,
               java.lang.String ns_prefix,
               org.esau.ptarmigan.util.MultiMap content_map,
               java.lang.String key,
               int limit)
         throws org.xml.sax.SAXException
write elements for key found in the map as date values


writeString

void writeString(org.esau.ptarmigan.util.MultiMap map,
                 java.lang.String key,
                 int limit)
           throws org.xml.sax.SAXException

writeInteger

void writeInteger(org.esau.ptarmigan.util.MultiMap map,
                  java.lang.String key,
                  int limit)
            throws org.xml.sax.SAXException

writeDate

void writeDate(org.esau.ptarmigan.util.MultiMap map,
               java.lang.String key,
               int limit)
         throws org.xml.sax.SAXException