public void connect() throws IOException {
		StreamEventListener[] listeners = getStreamEventListeners();
		try {
			if(filename == null || "".equals(filename))
				throw new IOException("No filename was given");
			if(filename.indexOf("..") >= 0)
				throw new IOException("Relative paths are not allowed");
			if(path != null) {
				if(!path.endsWith("/") && !"".equals(path))
					path = path + "/";
				filename = path + filename;
			}
			setInputStream(fileInputStream = new FileInputStream(filename));
			Integer length = new Integer(fileInputStream.available());
			for(int i = 0; i < listeners.length; i++) {
				listeners[i].handleEvent(new StreamEvent("SourceLength", length, this));
			}
		}
		catch(IOException e) {
			for(int i = 0; i < listeners.length; i++) {
				listeners[i].handleEvent(new StreamEvent("SourceException", e, this));
			}			
			throw e;
		}
		connected = true;
	}