2
* Copyright 2003 The Apache Software Foundation
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
8
* http://www.apache.org/licenses/LICENSE-2.0
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
16
package net.sf.cglib.transform;
21
import org.apache.tools.ant.BuildException;
22
import org.objectweb.asm.*;
23
import org.objectweb.asm.commons.EmptyVisitor;
25
public class DumpFieldsTask extends AbstractProcessTask {
27
private PrintStream out;
29
public void setOutputFile(File outfile) {
30
this.outfile = outfile;
33
public void execute() throws BuildException {
35
out = new PrintStream(new FileOutputStream(outfile));
41
} catch (IOException e) {
42
throw new BuildException(e);
46
protected void processFile(File file) throws Exception {
47
InputStream in = new BufferedInputStream(new FileInputStream(file));
48
ClassReader r = new ClassReader(in);
49
r.accept(new EmptyVisitor() {
50
private String className;
52
public void visit(int version,
57
String[] interfaces) {
58
className = name.replace('/', '.');
61
public FieldVisitor visitField(int access,
66
out.println("class=" + className + ", field=" + name);
69
}, ClassReader.SKIP_DEBUG);