View Javadoc

1   package net.sf.jour.processor;
2   
3   import java.io.ByteArrayInputStream;
4   import java.io.IOException;
5   import java.io.InputStream;
6   
7   import javassist.CannotCompileException;
8   import javassist.CtClass;
9   
10  public class InstrumentedEntry implements Entry {
11  
12  	private Entry orig; 
13  	
14  	private CtClass ctClass;
15  	
16  	public InstrumentedEntry(Entry orig, CtClass ctClass) {
17  		this.orig = orig;
18  		this.ctClass = ctClass;
19  	}
20  	
21  	public InputStream getInputStream() throws IOException {
22  		try {
23  			return new ByteArrayInputStream(ctClass.toBytecode());
24  		} catch (CannotCompileException e) {
25  			throw new CompileIOException(e);
26  		}
27  	}
28  	
29  	public Entry getOrigin() {
30  		return orig;
31  	}
32  
33  	public String getName() {
34  		return this.orig.getName();
35  	}
36  
37  	public long getSize() {
38  		return -1; //this.orig.getSize();
39  	}
40  
41  	public long getTime() {
42  		return this.orig.getTime();
43  	}
44  
45  	public boolean isClass() {
46  		return true;
47  	}
48  
49  	public boolean isDirectory() {
50  		return false;
51  	}
52  	
53  }