org.jasig.portal.utils
Class SubstitutionServletOutputStream
java.lang.Object
java.io.OutputStream
javax.servlet.ServletOutputStream
org.jasig.portal.utils.SubstitutionServletOutputStream
- All Implemented Interfaces:
- java.io.Closeable, java.io.Flushable
public class SubstitutionServletOutputStream
- extends javax.servlet.ServletOutputStream
A filter presenting a ServletOutputStream that performs
word substitution (search&replace) on the fly.
7/25/05 - UP-1180 - dmindler@rutgers.edu
Modified to make use of optimized SubstitutionIntegerFilter
- Version:
- $Revision: 1.6.4.1 $
- Author:
- Peter Kharchenko
|
Constructor Summary |
SubstitutionServletOutputStream(javax.servlet.ServletOutputStream out,
byte[] target,
byte[] substitute)
Creates a new SubstitutionServletOutputStream instance. |
SubstitutionServletOutputStream(javax.servlet.ServletOutputStream out,
byte[] target,
byte[] substitute,
int bufferSize)
Creates a new SubstitutionServletOutputStream instance. |
| Methods inherited from class javax.servlet.ServletOutputStream |
print, print, print, print, print, print, print, println, println, println, println, println, println, println, println |
| Methods inherited from class java.io.OutputStream |
write, write |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
filter
SubstitutionIntegerFilter filter
SubstitutionServletOutputStream
public SubstitutionServletOutputStream(javax.servlet.ServletOutputStream out,
byte[] target,
byte[] substitute)
- Creates a new
SubstitutionServletOutputStream instance.
- Parameters:
out - a true ServletOutputStream value where processed stream should be directedtarget - a byte[] value of a target to be replacedsubstitute - a byte[] value with which the target will be replaced
SubstitutionServletOutputStream
public SubstitutionServletOutputStream(javax.servlet.ServletOutputStream out,
byte[] target,
byte[] substitute,
int bufferSize)
- Creates a new
SubstitutionServletOutputStream instance.
- Parameters:
out - a true ServletOutputStream value where processed stream should be directedtarget - a byte[] value of a target to be replacedsubstitute - a byte[] value with which the target will be replacedbufferSize - a buffer size
write
public void write(int i)
throws java.io.IOException
- Specified by:
write in class java.io.OutputStream
- Throws:
java.io.IOException
flush
public void flush()
throws java.io.IOException
- Specified by:
flush in interface java.io.Flushable- Overrides:
flush in class java.io.OutputStream
- Throws:
java.io.IOException
close
public void close()
throws java.io.IOException
- Specified by:
close in interface java.io.Closeable- Overrides:
close in class java.io.OutputStream
- Throws:
java.io.IOException
getCharArrayFromByteArray
private static char[] getCharArrayFromByteArray(byte[] c)
- A helper method to convert byte array to int array.
I am sure there's a way to cast it correctly, but I don't want to take my chances :)
- Parameters:
c - a byte[] value
- Returns:
- an
int[] value