Class RpcRshInputStream

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

    public class RpcRshInputStream
    extends java.io.InputStream
    Implements the lowest level of the P4Java RPC 'rsh' input stream architecture.

    This class does the most basic conversion from incoming bytes on the (TCP/IP) wire to a Java IO input stream whose contents are further decoded upstream.

    • Field Summary

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

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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int available()  
      void close()  
      protected java.io.InputStream getRshStream()  
      void mark​(int readlimit)  
      boolean markSupported()  
      int read()  
      int read​(byte[] bytes)  
      int read​(byte[] bytes, int offset, int len)  
      void reset()  
      protected void setRshStream​(java.io.InputStream rshStream)  
      long skip​(long n)  
      java.lang.String toString()  
      • Methods inherited from class java.io.InputStream

        nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
      • Methods inherited from class java.lang.Object

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

      • RpcRshInputStream

        public RpcRshInputStream​(java.io.InputStream inputstream,
                                 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:
        inputstream - non-null InputStream
        stats - non-null ServerStats
    • Method Detail

      • read

        public int read()
                 throws java.io.IOException
        Specified by:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • read

        public int read​(byte[] bytes)
                 throws java.io.IOException
        Overrides:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • read

        public int read​(byte[] bytes,
                        int offset,
                        int len)
                 throws java.io.IOException
        Overrides:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • skip

        public long skip​(long n)
                  throws java.io.IOException
        Overrides:
        skip in class java.io.InputStream
        Throws:
        java.io.IOException
      • available

        public int available()
                      throws java.io.IOException
        Overrides:
        available in class java.io.InputStream
        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.InputStream
        Throws:
        java.io.IOException
      • mark

        public void mark​(int readlimit)
        Overrides:
        mark in class java.io.InputStream
      • reset

        public void reset()
                   throws java.io.IOException
        Overrides:
        reset in class java.io.InputStream
        Throws:
        java.io.IOException
      • markSupported

        public boolean markSupported()
        Overrides:
        markSupported in class java.io.InputStream
      • toString

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

        protected java.io.InputStream getRshStream()
      • setRshStream

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