Class Client

  • All Implemented Interfaces:
    java.lang.Runnable

    public class Client
    extends java.lang.Thread
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.lang.Thread

        java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private Function<Client,​java.lang.Object> callback  
      private java.net.Socket connection  
      private java.lang.String host  
      private java.io.ObjectInputStream input  
      private java.io.ObjectOutputStream output  
      private int port  
      private java.lang.Object readObject  
      private boolean stop  
      • Fields inherited from class java.lang.Thread

        MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
    • Constructor Summary

      Constructors 
      Constructor Description
      Client​(java.lang.String host, int port)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      Function<Client,​java.lang.Object> getCallback()  
      java.lang.String getHost()  
      int getPort()  
      java.lang.Object read()  
      void run()  
      void send​(java.lang.Object obj)  
      void setCallback​(Function<Client,​java.lang.Object> callback)  
      void setHost​(java.lang.String host)  
      void setPort​(int port)  
      private void setupStreams()  
      • Methods inherited from class java.lang.Thread

        activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
      • Methods inherited from class java.lang.Object

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

      • output

        private java.io.ObjectOutputStream output
      • input

        private java.io.ObjectInputStream input
      • connection

        private java.net.Socket connection
      • readObject

        private java.lang.Object readObject
      • stop

        private boolean stop
      • host

        private java.lang.String host
      • port

        private int port
    • Constructor Detail

      • Client

        public Client​(java.lang.String host,
                      int port)
    • Method Detail

      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
        Overrides:
        run in class java.lang.Thread
      • read

        public java.lang.Object read()
      • setupStreams

        private void setupStreams()
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • close

        public void close()
      • send

        public void send​(java.lang.Object obj)
      • getHost

        public java.lang.String getHost()
        Returns:
        the host
      • setHost

        public void setHost​(java.lang.String host)
        Parameters:
        host - the host to set
      • getPort

        public int getPort()
        Returns:
        the port
      • setPort

        public void setPort​(int port)
        Parameters:
        port - the port to set
      • getCallback

        public Function<Client,​java.lang.Object> getCallback()
        Returns:
        the callback
      • setCallback

        public void setCallback​(Function<Client,​java.lang.Object> callback)
        Parameters:
        callback - the callback to set