WebLogic Server 7.0 Code Examples, BEA Systems, Inc.

examples.servlets.wrapper
Class CustomOutputStream

java.lang.Object
  |
  +--java.io.OutputStream
        |
        +--javax.servlet.ServletOutputStream
              |
              +--examples.servlets.wrapper.CustomOutputStream

public class CustomOutputStream
extends javax.servlet.ServletOutputStream

CustomOutputStream is a user defined custom OutputStream that substitutes the replace value for the key value in all output.

Author:
Copyright (c) 2002 by BEA Systems, Inc. All Rights Reserved.

Constructor Summary
CustomOutputStream(java.io.OutputStream os, java.lang.String ks, java.lang.String rs)
           
 
Method Summary
 void close()
          Implement the close method from java.io.OutputStream.
 void flush()
          Implement the flush method from java.io.OutputStream.
 void processStream()
          Writes out the substituted output.
 byte[] substitute(byte[] origStringBytes)
          Replaces all instances of the keyString with replaceString in the passed in byte array, then returns a byte array of the substituted output
 void write(int b)
          Writes the output.
 
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
 

Constructor Detail

CustomOutputStream

public CustomOutputStream(java.io.OutputStream os,
                          java.lang.String ks,
                          java.lang.String rs)
Method Detail

close

public void close()
           throws java.io.IOException
Implement the close method from java.io.OutputStream. Here, we make sure to call the processStream method first.
Overrides:
close in class java.io.OutputStream

flush

public void flush()
           throws java.io.IOException
Implement the flush method from java.io.OutputStream. Empties the baoStream.
Overrides:
flush in class java.io.OutputStream

processStream

public void processStream()
                   throws java.io.IOException
Writes out the substituted output. Calls the substitute method to do actual substitution.

substitute

public byte[] substitute(byte[] origStringBytes)
Replaces all instances of the keyString with replaceString in the passed in byte array, then returns a byte array of the substituted output

write

public void write(int b)
           throws java.io.IOException
Writes the output. Must be implemented in a class extending ServletOutputStream
Overrides:
write in class java.io.OutputStream

Documentation is available at
http://e-docs.bea.com/wls/docs70

Copyright © 2002 BEA Systems, Inc. All Rights Reserved.