1 package org.collectionspace.services.common.profile;
4 import javax.servlet.*;
6 public class BufferedServletOutputStream extends ServletOutputStream {
8 private ByteArrayOutputStream bos = new ByteArrayOutputStream( );
10 public String getAsString(){
11 byte[] buf = bos.toByteArray();
12 return new String(buf);
16 * @return the contents of the buffer.
18 public byte[] getBuffer( ) {
19 return this.bos.toByteArray( );
23 * This method must be defined for custom servlet output streams.
25 public void write(int data) {
29 // BufferedHttpResponseWrapper calls this method
30 public void reset( ) {
34 // BufferedHttpResponseWrapper calls this method
35 public void setBufferSize(int size) {
36 // no way to resize an existing ByteArrayOutputStream
37 this.bos = new ByteArrayOutputStream(size);