本文整理汇总了Java中org.reflections.util.Utils类的典型用法代码示例。如果您正苦于以下问题:Java Utils类的具体用法?Java Utils怎么用?Java Utils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Utils类属于org.reflections.util包,在下文中一共展示了Utils类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findFiles
import org.reflections.util.Utils; //导入依赖的package包/类
/** return an iterable of all {@link org.reflections.vfs.Vfs.File} in given urls, starting with given packagePrefix and matching nameFilter */
public static Iterable<File> findFiles(final Collection<URL> inUrls, final String packagePrefix, final Predicate<String> nameFilter) {
Predicate<File> fileNamePredicate = new Predicate<File>() {
public boolean apply(File file) {
String path = file.getRelativePath();
if (path.startsWith(packagePrefix)) {
String filename = path.substring(path.indexOf(packagePrefix) + packagePrefix.length());
return !Utils.isEmpty(filename) && nameFilter.apply(filename.substring(1));
} else {
return false;
}
}
};
return findFiles(inUrls, fileNamePredicate);
}
示例2: url
import org.reflections.util.Utils; //导入依赖的package包/类
public String url() {
if (CommonUtil.isEmpty(url) && !CommonUtil.isEmpty(altUrl)) {
return altUrl;
}
if (!Utils.isEmpty(urlTitle) && !CommonUtil.isEmpty(altUrlTitle)
&& urlTitle.length() < altUrlTitle.length()
&& !isImg(altUrl) && !isImg(altUrlTitle)) {
return altUrl;
}
if (CommonUtil.isEmpty(url)) {
return null;
}
return url;
}
示例3: title
import org.reflections.util.Utils; //导入依赖的package包/类
public String title() {
if (CommonUtil.isEmpty(urlTitle) && !CommonUtil.isEmpty(altUrlTitle)) {
return altUrlTitle;
}
if (!Utils.isEmpty(urlTitle) && !CommonUtil.isEmpty(altUrlTitle)
&& urlTitle.length() < altUrlTitle.length()
&& !isImg(altUrl) && !isImg(altUrlTitle)) {
return altUrlTitle;
}
if (CommonUtil.isEmpty(urlTitle)) {
return null;
}
return urlTitle;
}
示例4: getName
import org.reflections.util.Utils; //导入依赖的package包/类
public static String getName(Class type) {
if (type.isArray()) {
try {
Class cl = type;
int dim = 0; while (cl.isArray()) { dim++; cl = cl.getComponentType(); }
return cl.getName() + Utils.repeat("[]", dim);
} catch (Throwable e) {
//
}
}
return type.getName();
}
示例5: getOrCreateClassObject
import org.reflections.util.Utils; //导入依赖的package包/类
public ClassFile getOrCreateClassObject(final Vfs.File file) {
InputStream inputStream = null;
try {
inputStream = file.openInputStream();
DataInputStream dis = new DataInputStream(new BufferedInputStream(inputStream));
return new ClassFile(dis);
} catch (IOException e) {
throw new ReflectionsException("could not create class file from " + file.getName(), e);
} finally {
Utils.close(inputStream);
}
}
示例6: save
import org.reflections.util.Utils; //导入依赖的package包/类
public File save(Reflections reflections, String filename) {
try {
File file = Utils.prepareFile(filename);
Files.write(toString(reflections), file, Charset.defaultCharset());
return file;
} catch (IOException e) {
throw new RuntimeException(e);
}
}
示例7: close
import org.reflections.util.Utils; //导入依赖的package包/类
public void close() {
Utils.close(jarInputStream);
}