Package jodd.http.net

Class SocketHttpConnection

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.net.Socket socket  
      private int timeout  
    • Constructor Summary

      Constructors 
      Constructor Description
      SocketHttpConnection​(java.net.Socket socket)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Closes connection.
      java.io.InputStream getInputStream()
      Returns connection input stream.
      java.io.OutputStream getOutputStream()
      Returns connection output stream.
      java.net.Socket getSocket()
      Returns Socket used by this connection.
      void init()
      Initializes http connection after socket is created.
      void setTimeout​(int milliseconds)
      Sets the timeout for connections, in milliseconds.
      • Methods inherited from class java.lang.Object

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

      • socket

        protected final java.net.Socket socket
      • timeout

        private int timeout
    • Constructor Detail

      • SocketHttpConnection

        public SocketHttpConnection​(java.net.Socket socket)
    • Method Detail

      • getOutputStream

        public java.io.OutputStream getOutputStream()
                                             throws java.io.IOException
        Description copied from interface: HttpConnection
        Returns connection output stream.
        Specified by:
        getOutputStream in interface HttpConnection
        Throws:
        java.io.IOException
      • getInputStream

        public java.io.InputStream getInputStream()
                                           throws java.io.IOException
        Description copied from interface: HttpConnection
        Returns connection input stream.
        Specified by:
        getInputStream in interface HttpConnection
        Throws:
        java.io.IOException
      • close

        public void close()
        Description copied from interface: HttpConnection
        Closes connection. Ignores all exceptions.
        Specified by:
        close in interface HttpConnection
      • setTimeout

        public void setTimeout​(int milliseconds)
        Description copied from interface: HttpConnection
        Sets the timeout for connections, in milliseconds. With this option set to a non-zero timeout, connection will block for only this amount of time. If the timeout expires, an Exception is raised. The timeout must be > 0. A timeout of zero is interpreted as an infinite timeout.
        Specified by:
        setTimeout in interface HttpConnection
      • getSocket

        public java.net.Socket getSocket()
        Returns Socket used by this connection.