This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Autowired | |
private DefaultMQProducer defaultMQProducer; | |
@GetMapping("/mq") | |
public void mqtest(String info) throws Exception { | |
Message message = new Message("t_TopicTest", null, "12345", info.getBytes("UTF-8")); | |
// 这里用到了这个mq的异步处理,类似ajax,可以得到发送到mq的情况,并做相应的处理 | |
// 不过要注意的是这个是异步的 | |
defaultMQProducer.send(message, new SendCallback() { | |
@Override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@page import="java.util.regex.Matcher"%> | |
<%@page import="java.util.regex.Pattern"%> | |
<%@ page language="java" pageEncoding="UTF-8"%> | |
<%! | |
// \b 是单词边界(连着的两个(字母字符 与 非字母字符) 之间的逻辑上的间隔),字符串在编译时会被转码一次,所以是 "\\b" | |
// \B 是单词内部逻辑间隔(连着的两个字母字符之间的逻辑上的间隔) | |
String androidReg = "\\bandroid|Nexus\\b"; | |
String iosReg = "ip(hone|od|ad)"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Test{ | |
public void sayHello(){ | |
System.out.println("hello"); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hyx.net; | |
import java.io.BufferedReader; | |
import java.io.InputStreamReader; | |
import java.net.DatagramPacket; | |
import java.net.DatagramSocket; | |
import java.net.InetAddress; | |
public class UDPClient { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hyx.net; | |
import java.io.BufferedReader; | |
import java.io.InputStreamReader; | |
import java.io.PrintWriter; | |
import java.net.Socket; | |
import java.util.Scanner; | |
public class QClient { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hyx.net; | |
import java.io.DataInputStream; | |
import java.io.DataOutputStream; | |
import java.io.IOException; | |
import java.net.Socket; | |
import java.net.UnknownHostException; | |
public class ClientCaculator { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.net.Inet4Address; | |
import java.net.Inet6Address; | |
import java.net.InetAddress; | |
import java.net.UnknownHostException; | |
public class IPTest { | |
public static void main(String[] args) { | |
InetAddress address; | |
try { | |
//根据网址域名查出地址 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.InputStreamReader; | |
import java.io.OutputStream; | |
import java.io.PrintWriter; | |
import java.net.Socket; | |
public class EchoClient { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>ONKEYDOWN</title> | |
</head> | |
<body> | |
<!--简单的网页,仅含有一个输入框和一个span用来显示keyCode--> | |
<input type="text" name="" id="txt"> | |
<span id="help"></span> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//下面是引用的类 | |
import java.io.File; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.RandomAccessFile; | |
import java.net.HttpURLConnection; | |
import java.net.URL; | |
//下面是下载线程 | |
public class DownloadThread extends Thread{//继承自Thread |
NewerOlder