blob: 34f957679394308c1555bbf50e9da3b70bcc5b4b [file] [log] [blame]
Constantin Kaplinsky2859fdc2008-06-19 16:07:52 +00001//
2// Copyright (C) 2008 Wimba, Inc. All Rights Reserved.
3//
4// This is free software; you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation; either version 2 of the License, or
7// (at your option) any later version.
8//
9// This software is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this software; if not, write to the Free Software
16// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
17// USA.
18//
19
20//
21// FbsConnection.java
22//
23
24package com.tightvnc.rfbplayer;
25
26import java.io.*;
27import java.net.*;
28import java.applet.Applet;
29
30public class FbsConnection {
31
32 URL fbsURL;
33 URL fbiURL;
34 URL fbkURL;
35
36 FbsConnection(String fbsLocation, String indexLocationPrefix, Applet applet)
37 throws MalformedURLException {
38
39 URL base = null;
40 if (applet != null) {
41 base = applet.getCodeBase();
42 }
43 fbsURL = new URL(base, fbsLocation);
44 fbiURL = null;
45 fbkURL = null;
46 if (indexLocationPrefix != null) {
47 fbiURL = new URL(base, indexLocationPrefix + ".fbi");
48 fbkURL = new URL(base, indexLocationPrefix + ".fbk");
49 }
50 }
51
52 FbsInputStream connect(long timeOffset) throws IOException {
53 URLConnection connection = fbsURL.openConnection();
54 FbsInputStream fbs = new FbsInputStream(connection.getInputStream());
55 fbs.setTimeOffset(timeOffset);
56
57 return fbs;
58 }
59
60}