Class RpcSocketInputStream

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

    public class RpcSocketInputStream
    extends java.io.InputStream
    Implements the lowest level of the P4Java RPC input socket 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
      RpcSocketInputStream​(java.net.Socket socket, ServerStats stats)
      Construct a suitable stream for the passed-in socket.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.net.Socket getSocket()  
      protected java.io.InputStream getSockStream()  
      int read()  
      int read​(byte[] bytes)  
      int read​(byte[] bytes, int offset, int len)  
      protected void setSocket​(java.net.Socket socket)  
      protected void setSockStream​(java.io.InputStream sockStream)  
      • Methods inherited from class java.io.InputStream

        available, close, mark, markSupported, nullInputStream, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
      • Methods inherited from class java.lang.Object

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

      • RpcSocketInputStream

        public RpcSocketInputStream​(java.net.Socket socket,
                                    ServerStats stats)
        Construct a suitable stream for the passed-in socket. No assumptions are made about the passed-in socket except that a) it's not null, and b) it's been initialized and set up for reading (or at least the successful retrieval of a suitable input stream) by the caller.
        Parameters:
        socket - non-null socket
        stats - stats
    • 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
      • getSocket

        protected java.net.Socket getSocket()
      • setSocket

        protected void setSocket​(java.net.Socket socket)
      • getSockStream

        protected java.io.InputStream getSockStream()
      • setSockStream

        protected void setSockStream​(java.io.InputStream sockStream)