Share

Search Java Code Snippets


  Help us in improving the repository. Add new snippets through 'Submit Code Snippet ' link.





Java - Code Samples

 Sample 1. Code Sample / Example / Snippet of org.apache.bcel.classfile.ConstantUtf8

    public static String[] getClassDependencies(ConstantPool pool) {

String[] tempArray = new String[pool.getLength()];

int size = 0;

StringBuilder buf = new StringBuilder();



for (int idx = 0; idx < pool.getLength(); idx++) {

Constant c = pool.getConstant(idx);

if (c != null && c.getTag() == Constants.CONSTANT_Class) {

ConstantUtf8 c1 = (ConstantUtf8) pool.getConstant(((ConstantClass) c).getNameIndex());

buf.setLength(0);

buf.append(c1.getBytes());

for (int n = 0; n < buf.length(); n++) {

if (buf.charAt(n) == '/') {

buf.setCharAt(n, '.');

}

}



tempArray[size++] = buf.toString();

}

}



String[] dependencies = new String[size];

System.arraycopy(tempArray, 0, dependencies, 0, size);

return dependencies;

}


   Like      Feedback      org.apache.bcel.classfile.ConstantUtf8



Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner



comments powered by Disqus