com.ibm.wsspi.http

Class HttpOutputStream

  • java.lang.Object
    • java.io.OutputStream
      • com.ibm.wsspi.http.HttpOutputStream
  • All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable


    public class HttpOutputStream
    extends java.io.OutputStream
    HTTP transport output stream that wraps the bytebuffer usage and the HTTP channel write logic with an outputstream interface.
    • Constructor Summary

      Constructors 
      Constructor and Description
      HttpOutputStream(com.ibm.wsspi.http.channel.inbound.HttpInboundServiceContext context)
      Deprecated.  
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      void clear()
      Clear any current buffer content in the stream.
      void close() 
      void flush() 
      void flush(boolean ignoreFlag) 
      void flushBuffers()
      Flush the output array of buffers to the network below.
      void flushHeaders()
      Write the current set of response headers.
      long getBufferedCount()
      Query the amount of bytes currently buffered so far.
      int getBufferSize()
      Query the amount of data this stream is configured to buffer before an automatic write happens.
      long getBytesWritten()
      Query the amount of bytes written so far.
      boolean hasBufferedContent()
      Test whether this stream has any current data buffered, waiting to be written out.
      boolean isClosed()
      Query whether this stream is closed already or not.
      void setBufferSize(int size)
      Set the amount of data to buffer internally before the stream itself initiates a flush.
      void setContentLength(long length) 
      void setIsClosing(boolean b) 
      void setVirtualConnection(com.ibm.wsspi.channelfw.VirtualConnection inVC)
      Deprecated.  
      java.lang.String toString() 
      void write(byte[] value) 
      void write(byte[] value, int start, int len) 
      void write(int value) 
      void writeFile(java.nio.channels.FileChannel fc)
      Write a file channel onto the output stream.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • HttpOutputStream

        @Deprecated
        public HttpOutputStream(com.ibm.wsspi.http.channel.inbound.HttpInboundServiceContext context)
        Deprecated. 
        Constructor of an output stream for a given service context. This method should not be called by consumers of this SPI.
        Parameters:
        context -
    • Method Detail

      • setIsClosing

        public void setIsClosing(boolean b)
      • setVirtualConnection

        @Deprecated
        public void setVirtualConnection(com.ibm.wsspi.channelfw.VirtualConnection inVC)
        Deprecated. 
        Set the reference to the virtual connection. This method should not be called by consumers of this SPI.
        Parameters:
        inVC -
      • getBufferSize

        public int getBufferSize()
        Query the amount of data this stream is configured to buffer before an automatic write happens.
        Returns:
        int
      • setBufferSize

        public void setBufferSize(int size)
        Set the amount of data to buffer internally before the stream itself initiates a flush. A zero size means no buffer is done, each write call will flush data.
        Parameters:
        size -
        Throws:
        java.lang.IllegalStateException - if already writing data or closed
      • clear

        public void clear()
        Clear any current buffer content in the stream.
      • getBytesWritten

        public long getBytesWritten()
        Query the amount of bytes written so far.
        Returns:
        long
      • getBufferedCount

        public long getBufferedCount()
        Query the amount of bytes currently buffered so far.
        Returns:
        long
      • hasBufferedContent

        public final boolean hasBufferedContent()
        Test whether this stream has any current data buffered, waiting to be written out.
        Returns:
        boolean
      • writeFile

        public void writeFile(java.nio.channels.FileChannel fc)
                       throws java.io.IOException
        Write a file channel onto the output stream.
        Parameters:
        fc -
        Throws:
        java.io.IOException
      • flushHeaders

        public void flushHeaders()
                          throws java.io.IOException
        Write the current set of response headers. If the headers have already been sent, this is a no-op.
        Throws:
        java.io.IOException
      • flushBuffers

        public void flushBuffers()
                          throws java.io.IOException
        Flush the output array of buffers to the network below.
        Throws:
        java.io.IOException
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • close

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

        public final boolean isClosed()
        Query whether this stream is closed already or not.
        Returns:
        boolean
      • 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
      • flush

        public void flush(boolean ignoreFlag)
                   throws java.io.IOException
        Throws:
        java.io.IOException
      • setContentLength

        public void setContentLength(long length)
      • write

        public void write(byte[] value,
                 int start,
                 int len)
                   throws java.io.IOException
        Overrides:
        write in class java.io.OutputStream
        Throws:
        java.io.IOException
      • write

        public void write(byte[] value)
                   throws java.io.IOException
        Overrides:
        write in class java.io.OutputStream
        Throws:
        java.io.IOException
      • write

        public void write(int value)
                   throws java.io.IOException
        Specified by:
        write in class java.io.OutputStream
        Throws:
        java.io.IOException