Module org.hsqldb

Class HsqlSocketFactory

  • Direct Known Subclasses:
    HsqlSocketFactorySecure

    public class HsqlSocketFactory
    extends java.lang.Object
    Base class for producing the Socket objects used by HSQLDB.
    Since:
    1.7.2
    Author:
    Blaine Simpson (blaine dot simpson at admc dot com), Campbell Burnet (campbell-burnet@users dot sourceforge.net)
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void configureSocket​(java.net.Socket socket)  
      java.net.ServerSocket createServerSocket​(int port)
      Returns a server socket bound to the specified port.
      java.net.ServerSocket createServerSocket​(int port, java.lang.String address)
      Returns a server socket bound to the specified port.
      java.net.Socket createSocket​(java.lang.String host, int port)
      Creates a socket and connects it to the specified remote host at the specified remote port.
      java.net.Socket createSocket​(java.net.Socket socket, java.lang.String host, int port)
      If socket argument is not null, returns it.
      static HsqlSocketFactory getInstance​(boolean tls)
      Retrieves an HsqlSocketFactory whose subclass and attributes are determined by the specified argument, tls.
      boolean isSecure()
      Retrieves whether this factory produces secure sockets.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getInstance

        public static HsqlSocketFactory getInstance​(boolean tls)
                                             throws java.lang.Exception
        Retrieves an HsqlSocketFactory whose subclass and attributes are determined by the specified argument, tls.
        Parameters:
        tls - whether to retrieve a factory producing SSL sockets
        Returns:
        a new factory
        Throws:
        java.lang.Exception - if the new factory cannot be constructed or is of the wrong type
      • configureSocket

        public void configureSocket​(java.net.Socket socket)
      • createServerSocket

        public java.net.ServerSocket createServerSocket​(int port)
                                                 throws java.lang.Exception
        Returns a server socket bound to the specified port. The socket is configured with the socket options given to this factory.
        Parameters:
        port - the port to which to bind the ServerSocket
        Returns:
        the ServerSocket
        Throws:
        java.lang.Exception - if a network error occurs
      • createServerSocket

        public java.net.ServerSocket createServerSocket​(int port,
                                                        java.lang.String address)
                                                 throws java.lang.Exception
        Returns a server socket bound to the specified port. The socket is configured with the socket options given to this factory.
        Parameters:
        port - the port to which to bind the ServerSocket
        address - String
        Returns:
        the ServerSocket
        Throws:
        java.lang.Exception - if a network error occurs
      • createSocket

        public java.net.Socket createSocket​(java.net.Socket socket,
                                            java.lang.String host,
                                            int port)
                                     throws java.lang.Exception
        If socket argument is not null, returns it. If it is null, creates a socket and connects it to the specified remote host at the specified remote port. This socket is configured using the socket options established for this factory.
        Parameters:
        socket - the existing socket, can be null
        host - the server host
        port - the server port
        Returns:
        the socket
        Throws:
        java.lang.Exception - if a network error occurs
      • createSocket

        public java.net.Socket createSocket​(java.lang.String host,
                                            int port)
                                     throws java.lang.Exception
        Creates a socket and connects it to the specified remote host at the specified remote port. This socket is configured using the socket options established for this factory.
        Parameters:
        host - the server host
        port - the server port
        Returns:
        the socket
        Throws:
        java.lang.Exception - if a network error occurs
      • isSecure

        public boolean isSecure()
        Retrieves whether this factory produces secure sockets.
        Returns:
        true if this factory produces secure sockets