我扼杀了程序并编写了示例,以便它可以一次性运行 javac *.java && java Main
注意:这主要是关于TheClient.java
<CommentOutToMakeWork>,并</CommentOutToMakeWork>已被注释掉,在一个SocketChannel将被阻塞和传输将完成Main.java:
import java.io.IOException;
import java.lang.InterruptedException;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
public class Main {
public static void main(String[] args) throws ExecutionException, IOException, InterruptedException {
final SocketAddress address = new InetSocketAddress("127.0.0.1", 12345);
final int size = 30 * 1000 * 1000;
ExecutorService executor …Run Code Online (Sandbox Code Playgroud) 我编译了以下方法:
public static final boolean equalTo(final int x, final int y) {
return x == y;
}
Run Code Online (Sandbox Code Playgroud)
可以javap看到为其生成了以下字节码:
public static final boolean equalTo(int, int);
descriptor: (II)Z
flags: (0x0019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL
Code:
stack=2, locals=2, args_size=2
0: iload_0
1: iload_1
2: if_icmpne 9
5: iconst_1
6: goto 10
9: iconst_0
10: ireturn
LineNumberTable:
line 72: 0
StackMapTable: number_of_entries = 2
frame_type = 9 /* same */
frame_type = 64 /* same_locals_1_stack_item */
stack = [ int ]
Run Code Online (Sandbox Code Playgroud)
我编写了 …
java ×3
bytecode ×1
encryption ×1
jce ×1
jvm ×1
jvm-bytecode ×1
nio ×1
serversocket ×1
sockets ×1