Code re-organization to make it easier implement backward seeking.


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2515 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/java/src/com/tightvnc/rfbplayer/RfbProto.java b/java/src/com/tightvnc/rfbplayer/RfbProto.java
index 4cada13..2faf66c 100644
--- a/java/src/com/tightvnc/rfbplayer/RfbProto.java
+++ b/java/src/com/tightvnc/rfbplayer/RfbProto.java
@@ -27,7 +27,7 @@
 import java.io.*;
 import java.awt.*;
 import java.awt.event.*;
-import java.net.Socket;
+import java.net.*;
 
 class RfbProto {
 
@@ -73,6 +73,7 @@
 
   final static int TightMinToCompress   = 12;
 
+  FbsInputStream fbs;
   DataInputStream is;
 
 
@@ -80,12 +81,16 @@
   // Constructor.
   //
 
-  RfbProto(InputStream is) throws Exception {
-    newInputStream(is);
+  RfbProto(URL url) throws Exception {
+    fbs = null;
+    newSession(url);
   }
 
-  public void newInputStream(InputStream is) throws Exception {
-    this.is = new DataInputStream(is);
+  public void newSession(URL url) throws Exception {
+    if (fbs != null)
+      fbs.close();
+    fbs = new FbsInputStream(url.openStream());
+    is = new DataInputStream(fbs);
 
     readVersionMsg();
     if (readAuthScheme() != NoAuth) {