001
014
015 package com.liferay.portal.kernel.servlet;
016
017 import java.io.IOException;
018 import java.io.OutputStream;
019
020 import javax.servlet.ServletOutputStream;
021
022
025 public class ServletOutputStreamAdapter extends ServletOutputStream {
026
027 public ServletOutputStreamAdapter(OutputStream outputStream) {
028 this.outputStream = outputStream;
029 }
030
031 @Override
032 public void close() throws IOException {
033 try {
034 flush();
035 }
036 catch (IOException ioe) {
037 }
038
039 outputStream.close();
040 }
041
042 @Override
043 public void flush() throws IOException {
044 outputStream.flush();
045 }
046
047 @Override
048 public void write(byte[] bytes) throws IOException {
049 outputStream.write(bytes, 0, bytes.length);
050 }
051
052 @Override
053 public void write(byte[] bytes, int offset, int length) throws IOException {
054 outputStream.write(bytes, offset, length);
055 }
056
057 @Override
058 public void write(int b) throws IOException {
059 outputStream.write(b);
060 }
061
062 protected OutputStream outputStream;
063
064 }