/sigmah/src/test/java/org/sigmah/server/mock/MockServletOutputStream.java
http://sigma-h.googlecode.com/ · Java · 33 lines · 19 code · 7 blank · 7 comment · 0 complexity · 52606bbcf1a9955121b5822e4208f4c1 MD5 · raw file
- /*
- * All Sigmah code is released under the GNU General Public License v3
- * See COPYRIGHT.txt and LICENSE.txt.
- */
-
- package org.sigmah.server.mock;
-
- import javax.servlet.ServletOutputStream;
- import java.io.ByteArrayOutputStream;
- import java.io.IOException;
-
- /**
- * @author Alex Bertram
- */
- public class MockServletOutputStream extends ServletOutputStream {
-
- private ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
- public void flush() throws IOException {
- baos.flush();
- }
-
- public void write(byte[] b) throws IOException {
- baos.write(b);
- }
-
- @Override
- public void write(int b) throws IOException {
- byte[] ba = new byte[1];
- ba[0] = (byte) b;
- baos.write(ba);
- }
- }