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

top.hmtools.pathToStream.ClasspathPathToStream Maven / Gradle / Ivy

The newest version!
package top.hmtools.pathToStream;

import java.io.InputStream;

import org.ansj.dic.PathToStream;

/**
 * 自定义的 从 classpath下加载
 * @author Hybomyth
 *
 */
public class ClasspathPathToStream extends PathToStream {

	@Override
	public InputStream toStream(final String path) {
		if(path==null||path.length()<1){
			throw new RuntimeException("字典路径为空");
		}
		String[] split = path.split("\\|");
		InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(split[1]);
		return inputStream;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy