Class RpcRshOutputStream

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

    public class RpcRshOutputStream
    extends java.io.OutputStream
    Implements the lowest level of the P4Java RPC 'rsh' output stream architecture.

    This class does the most basic conversion of outgoing bytes to the (TCP/IP) wire from a Java IO output stream whose contents have been encoded upstream.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String TRACE_PREFIX  
    • Constructor Summary

      Constructors 
      Constructor Description
      RpcRshOutputStream​(java.io.OutputStream outputstream, ServerStats stats)
      Construct a suitable stream for the passed-in inputstream.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      void flush()  
      protected java.io.OutputStream getRshStream()  
      protected void setRshStream​(java.io.OutputStream rshStream)  
      java.lang.String toString()  
      void write​(byte[] bytes)  
      void write​(byte[] bytes, int offset, int len)  
      void write​(int b)  
      • Methods inherited from class java.io.OutputStream

        nullOutputStream
      • Methods inherited from class java.lang.Object

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

      • RpcRshOutputStream

        public RpcRshOutputStream​(java.io.OutputStream outputstream,
                                  ServerStats stats)
        Construct a suitable stream for the passed-in inputstream. No assumptions are made about the passed-in inputstream except that a) it's not null, and b) it's been initialized and set up for reading by the caller.
        Parameters:
        outputstream - non-null OutputStream
        stats - non-null ServerStats
    • Method Detail

      • write

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

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

        public void write​(byte[] bytes,
                          int offset,
                          int len)
                   throws java.io.IOException
        Overrides:
        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
      • toString

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

        protected java.io.OutputStream getRshStream()
      • setRshStream

        protected void setRshStream​(java.io.OutputStream rshStream)