Class ServletOutputStreamWrapper

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable

    public class ServletOutputStreamWrapper
    extends javax.servlet.ServletOutputStream
    A facade of OutputStream for implementing ServletOutputStream.
    Author:
    tomyeh
    • Constructor Summary

      Constructors 
      Constructor Description
      ServletOutputStreamWrapper​(java.io.Writer writer, java.lang.String charset)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      void flush()  
      static javax.servlet.ServletOutputStream getInstance​(java.io.OutputStream stream)
      Returns a facade of the specified stream.
      static javax.servlet.ServletOutputStream getInstance​(java.io.Writer writer, java.lang.String charset)
      Returns a facade of the specified writer.
      boolean isReady()  
      void setWriteListener​(javax.servlet.WriteListener writeListener)  
      void 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

        nullOutputStream, write, write
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ServletOutputStreamWrapper

        public ServletOutputStreamWrapper​(java.io.Writer writer,
                                          java.lang.String charset)
        Parameters:
        charset - the charset. If null, "UTF-8" is assumed.
    • Method Detail

      • getInstance

        public static javax.servlet.ServletOutputStream getInstance​(java.io.OutputStream stream)
        Returns a facade of the specified stream.
      • getInstance

        public static javax.servlet.ServletOutputStream getInstance​(java.io.Writer writer,
                                                                    java.lang.String charset)
        Returns a facade of the specified writer.
        Parameters:
        charset - the charset. If null, "UTF-8" is assumed.
      • write

        public void write​(int b)
                   throws java.io.IOException
        Specified by:
        write in class java.io.OutputStream
        Throws:
        java.io.IOException
      • flush

        public void flush()
                   throws java.io.IOException
        Specified by:
        flush in interface java.io.Flushable
        Overrides:
        flush in class java.io.OutputStream
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.OutputStream
        Throws:
        java.io.IOException
      • isReady

        public boolean isReady()
        Specified by:
        isReady in class javax.servlet.ServletOutputStream
      • setWriteListener

        public void setWriteListener​(javax.servlet.WriteListener writeListener)
        Specified by:
        setWriteListener in class javax.servlet.ServletOutputStream