net.wimpi.text
Class ProcessingPipeImpl

java.lang.Object
  |
  +--net.wimpi.text.AbstractProcessor
        |
        +--net.wimpi.text.ProcessingPipeImpl
All Implemented Interfaces:
ProcessingPipe, Processor

public class ProcessingPipeImpl
extends AbstractProcessor
implements ProcessingPipe

Class that implements the ProcessingPipe interface. "Assembling" temporary "anonymous" pipes is supported through the empty constructor, and a int class attribute that is used as an increasing counter.

Version:
0.2 19/11/2002
Author:
Dieter Wimberger
See Also:
Processor

Fields inherited from class net.wimpi.text.AbstractProcessor
m_Properties
 
Constructor Summary
ProcessingPipeImpl()
           
ProcessingPipeImpl(java.lang.String name)
           
 
Method Summary
 void addProcessor(int pos, Processor proc)
          Adds a processor to this processing pipe, at a given position.
 void addProcessor(Processor proc)
          Adds a processor to this processing pipe.
 void flush()
          Removes all processors from this processing pipe.
 boolean isEmpty()
          Tests if the pipe is empty.
 java.io.InputStream process(java.io.InputStream in)
          Returns an InputStream where the processed given source InputStream can be read from.
 java.lang.String process(java.lang.String str)
          Processes the given String and returns the result as String.
 void removeProcessor(int pos)
          Removes the processor at the given position from this processing pipe.
 int size()
          Returns the count of all processors in this pipe.
 java.lang.String toString()
          Returns this processing pipe as String.
 
Methods inherited from class net.wimpi.text.AbstractProcessor
getDescription, getDescription, getName, getProperties, listAvailableLocales, setDefaultLocale, setDescription, setName, setProperties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.wimpi.text.Processor
getDescription, getDescription, getName, listAvailableLocales, setDefaultLocale, setDescription
 

Constructor Detail

ProcessingPipeImpl

public ProcessingPipeImpl()

ProcessingPipeImpl

public ProcessingPipeImpl(java.lang.String name)
Method Detail

addProcessor

public void addProcessor(Processor proc)
Description copied from interface: ProcessingPipe
Adds a processor to this processing pipe.
Specified by:
addProcessor in interface ProcessingPipe
Following copied from interface: net.wimpi.text.ProcessingPipe
Parameters:
proc - the Processor instance to be added to this processing pipe.
See Also:
Processor

addProcessor

public void addProcessor(int pos,
                         Processor proc)
                  throws java.lang.IndexOutOfBoundsException
Description copied from interface: ProcessingPipe
Adds a processor to this processing pipe, at a given position.
Specified by:
addProcessor in interface ProcessingPipe
Following copied from interface: net.wimpi.text.ProcessingPipe
Parameters:
pos - the position where the given Processor instance should be added as int.
proc - the Processor instance to be added to this processing pipe.
See Also:
Processor

removeProcessor

public void removeProcessor(int pos)
                     throws java.lang.IndexOutOfBoundsException
Description copied from interface: ProcessingPipe
Removes the processor at the given position from this processing pipe.
Specified by:
removeProcessor in interface ProcessingPipe
Following copied from interface: net.wimpi.text.ProcessingPipe
Parameters:
pos - the position of the Processor to be removed from this processing pipe.

flush

public void flush()
Description copied from interface: ProcessingPipe
Removes all processors from this processing pipe.
Specified by:
flush in interface ProcessingPipe

isEmpty

public boolean isEmpty()
Description copied from interface: ProcessingPipe
Tests if the pipe is empty. A pipe is empty if it does not contain any processor.
Specified by:
isEmpty in interface ProcessingPipe
Following copied from interface: net.wimpi.text.ProcessingPipe
Returns:
true if this processing pipe is empty, false otherwise.

size

public int size()
Description copied from interface: ProcessingPipe
Returns the count of all processors in this pipe. Note that contained processing pipes will be counted as single unit.
Specified by:
size in interface ProcessingPipe
Following copied from interface: net.wimpi.text.ProcessingPipe
Returns:
the count of processors in this processing pipe as int.

process

public java.lang.String process(java.lang.String str)
Description copied from interface: Processor
Processes the given String and returns the result as String.
Specified by:
process in interface Processor
Overrides:
process in class AbstractProcessor
Following copied from interface: net.wimpi.text.Processor
Returns:
the processed String.

process

public java.io.InputStream process(java.io.InputStream in)
                            throws java.io.IOException
Description copied from interface: Processor
Returns an InputStream where the processed given source InputStream can be read from. (Pull principle)
Specified by:
process in interface Processor
Overrides:
process in class AbstractProcessor
Following copied from interface: net.wimpi.text.Processor
Parameters:
the - source as InputStream.
Returns:
the InputStream to be read for the processed form of the given InputStream.
Throws:
java.io.IOException - if there is an I/O error.

toString

public java.lang.String toString()
Returns this processing pipe as String. The string representation is a comma separated list of processor names.
Overrides:
toString in class java.lang.Object
Returns:
the String representing this processing pipe's content as comma separated list of processor names.


Copyright 2001,2002 Dieter Wimberger. All Rights Reserved.