本文整理汇总了Java中edu.umd.cs.findbugs.classfile.ICodeBaseIterator类的典型用法代码示例。如果您正苦于以下问题:Java ICodeBaseIterator类的具体用法?Java ICodeBaseIterator怎么用?Java ICodeBaseIterator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ICodeBaseIterator类属于edu.umd.cs.findbugs.classfile包,在下文中一共展示了ICodeBaseIterator类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: iterator
import edu.umd.cs.findbugs.classfile.ICodeBaseIterator; //导入依赖的package包/类
public ICodeBaseIterator iterator() throws InterruptedException {
if (codeBase instanceof IScannableCodeBase) {
return ((IScannableCodeBase) codeBase).iterator();
} else {
return new ICodeBaseIterator() {
@Override
public boolean hasNext() throws InterruptedException {
return false;
}
@Override
public ICodeBaseEntry next() throws InterruptedException {
throw new UnsupportedOperationException();
}
};
}
}
示例2: iterator
import edu.umd.cs.findbugs.classfile.ICodeBaseIterator; //导入依赖的package包/类
@Override
public ICodeBaseIterator iterator() throws InterruptedException {
final Iterator<NSFCodeBaseEntry> itNSBE = m_Classes.values().iterator();
return new ICodeBaseIterator() {
@Override
public ICodeBaseEntry next() throws InterruptedException {
return itNSBE.next();
}
@Override
public boolean hasNext() throws InterruptedException {
return itNSBE.hasNext();
}
};
}
示例3: iterator
import edu.umd.cs.findbugs.classfile.ICodeBaseIterator; //导入依赖的package包/类
public ICodeBaseIterator iterator() throws InterruptedException {
if (codeBase instanceof IScannableCodeBase) {
return ((IScannableCodeBase) codeBase).iterator();
} else {
return new ICodeBaseIterator() {
public boolean hasNext() throws InterruptedException {
return false;
}
public ICodeBaseEntry next() throws InterruptedException {
throw new UnsupportedOperationException();
}
};
}
}
示例4: scanCodebase
import edu.umd.cs.findbugs.classfile.ICodeBaseIterator; //导入依赖的package包/类
/**
* Scan given codebase in order to
* <ul>
* <li>check the codebase for nested archives (adding any found to the
* worklist)
* <li>build a list of class resources found in the codebase
* </ul>
*
* @param workList
* the worklist
* @param discoveredCodeBase
* the codebase to scan
* @throws InterruptedException
*/
private void scanCodebase(IClassPath classPath, LinkedList<WorkListItem> workList, DiscoveredCodeBase discoveredCodeBase)
throws InterruptedException {
if (DEBUG) {
System.out.println("Scanning " + discoveredCodeBase.getCodeBase().getCodeBaseLocator());
}
IScannableCodeBase codeBase = (IScannableCodeBase) discoveredCodeBase.getCodeBase();
ICodeBaseIterator i = codeBase.iterator();
while (i.hasNext()) {
ICodeBaseEntry entry = i.next();
if (VERBOSE) {
System.out.println("Entry: " + entry.getResourceName());
}
if (!NO_PARSE_CLASS_NAMES && codeBase.isApplicationCodeBase()
&& DescriptorFactory.isClassResource(entry.getResourceName()) && !(entry instanceof SingleFileCodeBaseEntry)) {
parseClassName(entry);
}
// Note the resource exists in this codebase
discoveredCodeBase.addCodeBaseEntry(entry);
// If resource is a nested archive, add it to the worklist
if (scanNestedArchives && codeBase.isApplicationCodeBase() && Archive.isArchiveFileName(entry.getResourceName())) {
if (VERBOSE) {
System.out.println("Entry is an archive!");
}
ICodeBaseLocator nestedArchiveLocator = classFactory.createNestedArchiveCodeBaseLocator(codeBase,
entry.getResourceName());
addToWorkList(workList,
new WorkListItem(nestedArchiveLocator, codeBase.isApplicationCodeBase(), ICodeBase.NESTED));
}
}
}
示例5: iterator
import edu.umd.cs.findbugs.classfile.ICodeBaseIterator; //导入依赖的package包/类
public ICodeBaseIterator iterator() throws InterruptedException {
if (!searchPerformed) {
rfs.search();
searchPerformed = true;
}
return new DirectoryCodeBaseIterator();
}
示例6: iterator
import edu.umd.cs.findbugs.classfile.ICodeBaseIterator; //导入依赖的package包/类
public ICodeBaseIterator iterator() throws InterruptedException {
return new ICodeBaseIterator() {
boolean done = false;
/*
* (non-Javadoc)
*
* @see edu.umd.cs.findbugs.classfile.ICodeBaseIterator#hasNext()
*/
public boolean hasNext() throws InterruptedException {
return !done;
}
/*
* (non-Javadoc)
*
* @see edu.umd.cs.findbugs.classfile.ICodeBaseIterator#next()
*/
public ICodeBaseEntry next() throws InterruptedException {
if (done) {
throw new NoSuchElementException();
}
done = true;
return new SingleFileCodeBaseEntry(SingleFileCodeBase.this);
}
};
}
示例7: scanCodebase
import edu.umd.cs.findbugs.classfile.ICodeBaseIterator; //导入依赖的package包/类
/**
* Scan given codebase in order to
* <ul>
* <li>check the codebase for nested archives (adding any found to the
* worklist)
* <li>build a list of class resources found in the codebase
* </ul>
*
* @param workList
* the worklist
* @param discoveredCodeBase
* the codebase to scan
* @throws InterruptedException
*/
private void scanCodebase(IClassPath classPath, LinkedList<WorkListItem> workList, DiscoveredCodeBase discoveredCodeBase)
throws InterruptedException {
if (DEBUG) {
System.out.println("Scanning " + discoveredCodeBase.getCodeBase().getCodeBaseLocator());
}
IScannableCodeBase codeBase = (IScannableCodeBase) discoveredCodeBase.getCodeBase();
ICodeBaseIterator i = codeBase.iterator();
while (i.hasNext()) {
ICodeBaseEntry entry = i.next();
if (VERBOSE) {
System.out.println("Entry: " + entry.getResourceName());
}
if (!NO_PARSE_CLASS_NAMES && codeBase.isApplicationCodeBase()
&& DescriptorFactory.isClassResource(entry.getResourceName()) && !(entry instanceof SingleFileCodeBaseEntry)) {
parseClassName(entry);
}
// Note the resource exists in this codebase
discoveredCodeBase.addCodeBaseEntry(entry);
// If resource is a nested archive, add it to the worklist
if (scanNestedArchives && (codeBase.isApplicationCodeBase() || codeBase instanceof DirectoryCodeBase)
&& Archive.isLibraryFileName(entry.getResourceName())) {
if (VERBOSE) {
System.out.println("Entry is an library!");
}
ICodeBaseLocator nestedArchiveLocator = classFactory.createNestedArchiveCodeBaseLocator(codeBase,
entry.getResourceName());
addToWorkList(workList, new WorkListItem(nestedArchiveLocator, codeBase.isApplicationCodeBase(),
ICodeBase.Discovered.NESTED));
}
}
}
示例8: iterator
import edu.umd.cs.findbugs.classfile.ICodeBaseIterator; //导入依赖的package包/类
public ICodeBaseIterator iterator() {
return new MyIterator();
}
示例9: iterator
import edu.umd.cs.findbugs.classfile.ICodeBaseIterator; //导入依赖的package包/类
public ICodeBaseIterator iterator() throws InterruptedException {
return new DelegatingCodeBaseIterator(this, delegateCodeBase);
}
示例10: iterator
import edu.umd.cs.findbugs.classfile.ICodeBaseIterator; //导入依赖的package包/类
public ICodeBaseIterator iterator() {
final Enumeration<? extends ZipEntry> zipEntryEnumerator = zipFile.entries();
return new ICodeBaseIterator() {
ZipFileCodeBaseEntry nextEntry;
public boolean hasNext() {
scanForNextEntry();
return nextEntry != null;
}
/*
* (non-Javadoc)
*
* @see edu.umd.cs.findbugs.classfile.ICodeBaseIterator#next()
*/
public ICodeBaseEntry next() throws InterruptedException {
scanForNextEntry();
if (nextEntry == null) {
throw new NoSuchElementException();
}
ICodeBaseEntry result = nextEntry;
nextEntry = null;
return result;
}
private void scanForNextEntry() {
while (nextEntry == null) {
if (!zipEntryEnumerator.hasMoreElements()) {
return;
}
ZipEntry zipEntry = zipEntryEnumerator.nextElement();
if (!zipEntry.isDirectory()) {
addLastModifiedTime(zipEntry.getTime());
nextEntry = new ZipFileCodeBaseEntry(ZipFileCodeBase.this, zipEntry);
break;
}
}
}
};
}