Class RemoteServer


  • public class RemoteServer
    extends java.lang.Object
    Manages a tiny WebSocket server that can receive model data and viewer settings. Client apps can call acquireReceivedMessage to check for new data and pop it off the small internal queue.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  RemoteServer.ReceivedMessage
      Encapsulates a message sent from the web client.
    • Constructor Summary

      Constructors 
      Constructor Description
      RemoteServer​(int port)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      RemoteServer.ReceivedMessage acquireReceivedMessage()
      Pops a message off the incoming queue or returns null if there are no unread messages.
      void close()  
      protected void finalize()  
      static boolean isBinary​(java.lang.String label)
      Checks if a peeked message has binary content.
      static boolean isJson​(java.lang.String label)
      Checks if a peeked message has JSON content.
      java.lang.String peekIncomingLabel()
      Checks if a download is currently in progress and returns its label.
      • Methods inherited from class java.lang.Object

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

      • RemoteServer

        public RemoteServer​(int port)
    • Method Detail

      • peekIncomingLabel

        @Nullable
        public java.lang.String peekIncomingLabel()
        Checks if a download is currently in progress and returns its label. Returns null if nothing is being downloaded.
      • isJson

        public static boolean isJson​(@Nullable
                                     java.lang.String label)
        Checks if a peeked message has JSON content.
      • isBinary

        public static boolean isBinary​(@Nullable
                                       java.lang.String label)
        Checks if a peeked message has binary content.
      • acquireReceivedMessage

        @Nullable
        public RemoteServer.ReceivedMessage acquireReceivedMessage()
        Pops a message off the incoming queue or returns null if there are no unread messages.
      • close

        public void close()
      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.lang.Throwable