com.blade.loader.ClassPathRouteLoader Maven / Gradle / Ivy
package com.blade.loader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
/**
*
*
* 基于ClassPath实现的路由加载器
*
*
* @author biezhi
* @since 1.0
*/
public class ClassPathRouteLoader extends AbstractFileRouteLoader {
private File file;
private InputStream inputStream;
public ClassPathRouteLoader() {
}
public ClassPathRouteLoader(String filePath) {
this(new File(filePath));
}
public ClassPathRouteLoader(File file) {
this.file = file;
}
public ClassPathRouteLoader(InputStream inputStream) {
this.inputStream = inputStream;
}
@Override
protected InputStream getInputStream() throws Exception {
if(null != this.inputStream){
return this.inputStream;
}
return new FileInputStream(file);
}
protected void setInputStream(InputStream inputStream) {
this.inputStream = inputStream;
}
public void setFile(File file) {
this.file = file;
}
public void setFilePath(String filePath) {
this.file = new File(filePath);
}
}