net.sourceforge.stripes.mock
Class MockServletOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by javax.servlet.ServletOutputStream
          extended by net.sourceforge.stripes.mock.MockServletOutputStream
All Implemented Interfaces:
Closeable, Flushable

public class MockServletOutputStream
extends ServletOutputStream

Mock implementation of a ServletOutputStream that just uses a byte array output stream to capture any output and make it available after the test is done.

Since:
Stripes 1.1
Author:
Tim Fennell

Constructor Summary
MockServletOutputStream()
           
 
Method Summary
 byte[] getBytes()
          Returns the array of bytes that have been written to the output stream.
 String getString()
          Returns, as a character string, the output that was written to the output stream.
 void write(int b)
          Pass through method calls ByteArrayOutputStream.write(int b).
 
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
close, flush, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockServletOutputStream

public MockServletOutputStream()
Method Detail

write

public void write(int b)
           throws IOException
Pass through method calls ByteArrayOutputStream.write(int b).

Specified by:
write in class OutputStream
Throws:
IOException

getBytes

public byte[] getBytes()
Returns the array of bytes that have been written to the output stream.


getString

public String getString()
Returns, as a character string, the output that was written to the output stream.



? Copyright 2005-2006, Stripes Development Team.