public ProtobufDecoder(String[] classpath, String rootClass,
			FieldDefinition[] fields) throws ProtobufDecoderException {

		try {
			URL[] url = new URL[classpath.length];
			for (int i = 0; i < classpath.length; ++i) {
				String file = classpath[i];
				if (file.startsWith("file://")) {
					file = file.substring(7);
				}
				url[i] = new File(file).toURI().toURL();
			}
			this.classLoader = new URLClassLoader(url, getClass()
					.getClassLoader());
		} catch (MalformedURLException e) {
			throw new ProtobufDecoderException(e);
		}

		try {
			this.rootClass = classLoader.loadClass(rootClass);
		} catch (ClassNotFoundException e) {
			throw new ProtobufDecoderException("Can't find root class", e);
		}

		try {
			this.rootParseFromMethod = this.rootClass.getDeclaredMethod(
					"parseFrom", new Class<?>[] { byte[].class });
		} catch (SecurityException e) {
			throw new ProtobufDecoderException(e);
		} catch (NoSuchMethodException e) {
			throw new ProtobufDecoderException(
					"Can't setup Protocol Buffers decoder", e);
		}

		if (fields != null) {
			this.paths = new LinkedHashMap<String, Integer>();
			for (int i = 0; i < fields.length; ++i) {
				this.paths.put(fields[i].path, Integer.valueOf(i));
			}
			this.fields = fields;
		}
	}