All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sdsu.io.SubstringCountReader

java.lang.Object
   |
   +----java.io.Reader
           |
           +----java.io.FilterReader
                   |
                   +----sdsu.io.StringReplaceReader
                           |
                           +----sdsu.io.SubstringCountReader

public class SubstringCountReader
extends StringReplaceReader
Given a substring (pattern), a replacement pattern and an input stream, this class will replace all occurances of the substring (pattern) with the replacement pattern in the inputstream and count the number of times the substring occured in the input stream. Any occurance of the seqeunce "_@N" in the replacement pattern will be replaced with number of occurances of the substring up to that point in the stream. Useful for adding page numbers, line numbers, etc. You can give multiple substring-replacement pattern pairs. Each pattern is counted separately.

Version:
0.5 31 August 1997
Author:
Roger Whitney (whitney@cs.sdsu.edu)

Variable Index

 o COUNT_MARKER
Sequence of characters indicating where the current count should appear in replacement pattern.

Constructor Index

 o SubstringCountReader(InputStream, String, String, int)
Create a SubstringCountReader on inputstream in where the pattern substringToCount is replaced with newPattern.
 o SubstringCountReader(Reader, String, String)
Create a SubstringCountReader on Reader in where the pattern substringToCount is replaced with newPattern.
 o SubstringCountReader(Reader, String, String, int)
Create a SubstringCountReader on Reader in where the pattern substringToCount is replaced with newPattern.
 o SubstringCountReader(String, String, String, int)
Create a SubstringCountReader on string in where the pattern substringToCount is replaced with newPattern.

Method Index

 o getCount()
Returns the current count of the number of times the pattern has occured.

Variables

 o COUNT_MARKER
 public static final String COUNT_MARKER
Sequence of characters indicating where the current count should appear in replacement pattern.

Constructors

 o SubstringCountReader
 public SubstringCountReader(String in,
                             String substringToCount,
                             String newPattern,
                             int initialCount)
Create a SubstringCountReader on string in where the pattern substringToCount is replaced with newPattern. The counting of the pattern starts at value initialCount.

 o SubstringCountReader
 public SubstringCountReader(InputStream in,
                             String substringToCount,
                             String newPattern,
                             int initialCount)
Create a SubstringCountReader on inputstream in where the pattern substringToCount is replaced with newPattern. The counting of the pattern starts at value initialCount.

 o SubstringCountReader
 public SubstringCountReader(Reader in,
                             String substringToCount,
                             String newPattern,
                             int initialCount)
Create a SubstringCountReader on Reader in where the pattern substringToCount is replaced with newPattern. The counting of the pattern starts at value initialCount.

 o SubstringCountReader
 public SubstringCountReader(Reader in,
                             String substringToCount,
                             String newPattern)
Create a SubstringCountReader on Reader in where the pattern substringToCount is replaced with newPattern. The counting of the pattern starts at value 1.

Methods

 o getCount
 public int getCount()
Returns the current count of the number of times the pattern has occured.


All Packages  Class Hierarchy  This Package  Previous  Next  Index