-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathCompiledCode.java
More file actions
35 lines (28 loc) · 816 Bytes
/
CompiledCode.java
File metadata and controls
35 lines (28 loc) · 816 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package org.mdkt.compiler;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URI;
import javax.tools.JavaFileObject;
import javax.tools.SimpleJavaFileObject;
/**
* Created by trung on 5/3/15.
*/
public class CompiledCode extends SimpleJavaFileObject {
private ByteArrayOutputStream baos = new ByteArrayOutputStream();
private String className;
public CompiledCode(String className) throws Exception {
super(new URI(className), Kind.CLASS);
this.className = className;
}
public String getClassName() {
return className;
}
@Override
public OutputStream openOutputStream() throws IOException {
return baos;
}
public byte[] getByteCode() {
return baos.toByteArray();
}
}