Constantin Kaplinsky | 2859fdc | 2008-06-19 16:07:52 +0000 | [diff] [blame^] | 1 | // |
| 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 | |
| 24 | package com.tightvnc.rfbplayer; |
| 25 | |
| 26 | import java.io.*; |
| 27 | import java.net.*; |
| 28 | import java.applet.Applet; |
| 29 | |
| 30 | public 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 | } |