gnu.xml.pipeline
Class TeeConsumer
- ContentHandler, DeclHandler, DTDHandler, EventConsumer, LexicalHandler
Fans its events out to two other consumers, a "tee" filter stage in an
event pipeline. Networks can be assembled with multiple output points.
Error handling should be simple if you remember that exceptions
you throw will cancel later stages in that callback's pipeline, and
generally the producer will stop if it sees such an exception. You
may want to protect your pipeline against such backflows, making a
kind of reverse filter (or valve?) so that certain exceptions thrown by
your pipeline will caught and handled before the producer sees them.
Just use a "try/catch" block, rememebering that really important
cleanup tasks should be in "finally" clauses.
That issue isn't unique to "tee" consumers, but tee consumers have
the additional twist that exceptions thrown by the first consumer
will cause the second consumer not to see the callback (except for
the endDocument callback, which signals state cleanup).
void | attributeDecl(String eName, String aName, String type, String mode, String value)
|
void | characters(ch[] , int start, int length)
|
void | comment(ch[] , int start, int length)
|
void | elementDecl(String name, String model)
|
void | endCDATA()
|
void | endDTD()
|
void | endDocument()
|
void | endElement(String uri, String localName, String qName)
|
void | endEntity(String name)
|
void | endPrefixMapping(String prefix)
|
void | externalEntityDecl(String name, String publicId, String systemId)
|
ContentHandler | getContentHandler() - Returns the content handler being used.
|
DTDHandler | getDTDHandler() - Returns the dtd handler being used.
|
EventConsumer | getFirst() - Returns the first pipeline to get event calls.
|
Object | getProperty(String id) - Returns the declaration or lexical handler being used.
|
EventConsumer | getRest() - Returns the second pipeline to get event calls.
|
void | ignorableWhitespace(ch[] , int start, int length)
|
void | internalEntityDecl(String name, String value)
|
void | notationDecl(String name, String publicId, String systemId)
|
void | processingInstruction(String target, String data)
|
void | setDocumentLocator(Locator locator)
|
void | setErrorHandler(ErrorHandler handler) - Provides the error handler to both subsequent nodes of
this filter stage.
|
void | skippedEntity(String name)
|
void | startCDATA()
|
void | startDTD(String name, String publicId, String systemId)
|
void | startDocument()
|
void | startElement(String uri, String localName, String qName, Attributes atts)
|
void | startEntity(String name)
|
void | startPrefixMapping(String prefix, String uri)
|
void | unparsedEntityDecl(String name, String publicId, String systemId, String notationName)
|
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
TeeConsumer
public TeeConsumer(EventConsumer car,
EventConsumer cdr)
Constructs a consumer which sends all its events to the first
consumer, and then the second one. If the first consumer throws
an exception, the second one will not see the event which
caused that exception to be reported.
car
- The first consumer to get the eventscdr
- The second consumer to get the events
TeeConsumer.java --
Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.