Code refactoring in preparation to more efficient seeking. Now we handle initial time offset in RfbProto constructor and its newSession() method.

git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2587 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/java/src/com/tightvnc/rfbplayer/RfbProto.java b/java/src/com/tightvnc/rfbplayer/RfbProto.java
index a37cd61..080dfad 100644
--- a/java/src/com/tightvnc/rfbplayer/RfbProto.java
+++ b/java/src/com/tightvnc/rfbplayer/RfbProto.java
@@ -73,9 +73,9 @@
   //
   // Constructor.
   //
-  RfbProto(URL url) throws Exception {
+  RfbProto(URL url, long timeOffset) throws Exception {
     fbs = null;
-    newSession(url);
+    newSession(url, timeOffset);
   }
 
   // Force processing to quit
@@ -91,7 +91,7 @@
   //
   // Open new session URL.
   //
-  public void newSession(URL url) throws Exception {
+  public void newSession(URL url, long timeOffset) throws Exception {
     if (fbs != null)
       fbs.close();
 
@@ -107,6 +107,11 @@
       throw new Exception("Wrong authentication type in the session file");
     }
     readServerInit();
+
+    // Go to initial position but make sure not to seek backwards.
+    if (timeOffset > fbs.getTimeOffset()) {
+      fbs.setTimeOffset(timeOffset);
+    }
   }
 
   //