org.jasig.portal.utils
Class SubstitutionIntegerFilter
java.lang.Object
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
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
SubstitutionIntegerFilter
public SubstitutionIntegerFilter(java.io.Writer out,
char[] target,
char[] substitute)
- Creates a new
SubstitutionIntegerFilter
instance.
- Parameters:
out
- an IWriteable
object valuetarget
- an int[]
pattern to be replacedsubstitute
- 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 valuetarget
- an int[]
pattern to be replacedsubstitute
- an int[]
pattern to replace the originalbufferSize
- a buffer size
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