org.jasig.portal.utils
Class SubstitutionIntegerFilter

java.lang.Object
  extended by org.jasig.portal.utils.SubstitutionIntegerFilter

public class SubstitutionIntegerFilter
extends java.lang.Object

Performs substitution operation on a stream of integer write requests. 7/25/05 - UP-1180 - dmindler@rutgers.edu Modified to utilize characters instead of integers. Main reason is that actual writing was delegated to the WriteableWriterWrapper class, who had a statement: cbuf[j++]=(char)ibuf[i]; in effect, converting an integer to a character. This was an expensive transformation since all data was copied into an int[] then a char[] was allocated in the WriteableWriterWrapper class to which all data was copied (as shown above): char[] cbuf = new char[len-off]; Note: This class name was not changed.

Version:
$Revision: 1.8.4.1 $
Author:
Peter Kharchenko

Field Summary
private  char[] buffer
           
private  int bufferindex
           
private static int DEFAULT_BUFFER_SIZE
           
private  int matchindex
           
private  int maxBuffer
           
(package private)  java.io.Writer out
           
(package private)  char[] substitute
           
(package private)  char[] target
           
 
Constructor Summary
SubstitutionIntegerFilter(java.io.Writer out, char[] target, char[] substitute)
          Creates a new SubstitutionIntegerFilter instance.
SubstitutionIntegerFilter(java.io.Writer out, char[] target, char[] substitute, int bufferSize)
          Creates a new SubstitutionIntegerFilter instance.
 
Method Summary
protected  void addToBuffer(char i)
           
 void close()
           
 void flush()
           
 void write(char number)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_BUFFER_SIZE

private static final int DEFAULT_BUFFER_SIZE
See Also:
Constant Field Values

out

final java.io.Writer out

substitute

final char[] substitute

target

final char[] target

matchindex

private int matchindex

buffer

private char[] buffer

bufferindex

private int bufferindex

maxBuffer

private int maxBuffer
Constructor Detail

SubstitutionIntegerFilter

public SubstitutionIntegerFilter(java.io.Writer out,
                                 char[] target,
                                 char[] substitute)
Creates a new SubstitutionIntegerFilter instance.

Parameters:
out - an IWriteable object value
target - an int[] pattern to be replaced
substitute - an int[] pattern to replace the original

SubstitutionIntegerFilter

public SubstitutionIntegerFilter(java.io.Writer out,
                                 char[] target,
                                 char[] substitute,
                                 int bufferSize)
Creates a new SubstitutionIntegerFilter instance.

Parameters:
out - an IWriteable object value
target - an int[] pattern to be replaced
substitute - an int[] pattern to replace the original
bufferSize - a buffer size
Method Detail

write

public void write(char number)
           throws java.io.IOException
Throws:
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Throws:
java.io.IOException

addToBuffer

protected void addToBuffer(char i)
                    throws java.io.IOException
Throws:
java.io.IOException