本文整理匯總了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);
}