All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.dangdang.config.service.file.protocol.ClasspathProtocol Maven / Gradle / Ivy

There is a newer version: 3.3.2-RELEASE
Show newest version
package com.dangdang.config.service.file.protocol;

import java.net.URISyntaxException;
import java.nio.file.Path;
import java.nio.file.Paths;

import com.dangdang.config.service.exception.InvalidPathException;
import com.dangdang.config.service.file.FileLocation;
import com.google.common.io.Resources;

/**
 * @author Yuxuan Wang
 *
 */
public class ClasspathProtocol extends LocalFileProtocol {

	@Override
	protected Path getPath(FileLocation location) throws InvalidPathException {
		try {
			return Paths.get(Resources.getResource(location.getFile()).toURI());
		} catch (URISyntaxException e) {
			throw new InvalidPathException(e);
		}
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy