corejava第8版
This commit is contained in:
1 parent
75e83a331f
commit
e89542a214
522 files changed
+98293
No files matched your search
@@ -0,0 +1,33 @@
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import javax.tools.*;
|
||||
|
||||
/**
|
||||
* A Java class that holds the bytecodes in a byte array.
|
||||
* @version 1.00 2007-11-02
|
||||
* @author Cay Horstmann
|
||||
*/
|
||||
public class ByteArrayJavaClass extends SimpleJavaFileObject
|
||||
{
|
||||
/**
|
||||
* Constructs a new ByteArrayJavaClass
|
||||
* @param name the name of the class file represented by this file object
|
||||
*/
|
||||
public ByteArrayJavaClass(String name)
|
||||
{
|
||||
super(URI.create("bytes:///" + name), Kind.CLASS);
|
||||
stream = new ByteArrayOutputStream();
|
||||
}
|
||||
|
||||
public OutputStream openOutputStream() throws IOException
|
||||
{
|
||||
return stream;
|
||||
}
|
||||
|
||||
public byte[] getBytes()
|
||||
{
|
||||
return stream.toByteArray();
|
||||
}
|
||||
|
||||
private ByteArrayOutputStream stream;
|
||||
}
|
||||
Reference in new issue
Block a user