⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 protocol.java

📁 用java开发的一些实用的短信通信模块其中包含MD5加密、http发送等信息
💻 JAVA
字号:
package lib.commons.net;

import lib.commons.Utils;

public class Protocol {
	private String _name;

	private int _defaultPort;

	private Protocol(String name, int defaultPort) {
		this._name = name;
		this._defaultPort = defaultPort;
	}

	public String getName() {
		return _name;
	}

	public int getDefaultPort() {
		return _defaultPort;
	}

	public String toString() {
		return this.getName() + "://";
	}

	public static final Protocol HTTP = new Protocol("HTTP", 80);

	public static final Protocol FILE = new Protocol("FILE", 0);

	private static final Protocol[] Protocols = new Protocol[] { HTTP, FILE };

	public static final Protocol getProtocol(String protocolString) {
		Protocol protocol = null;
		if (!Utils.StringIsNullOrEmpty(protocolString)) {
			for (int i = 0; i < Protocols.length; i++) {
				if (Protocols[i].getName().equals(protocolString.toUpperCase())) {
					protocol = Protocols[i];
					break;
				}
			}
		}
		return protocol;
	}

	public static final Protocol parseProtocol(String protocolString) {
		Protocol protocol = null;
		if (!Utils.StringIsNullOrEmpty(protocolString)) {
			String protocolStr = protocolString.replace("://",
					Utils.EMPTY_STRING);
			protocol = getProtocol(protocolStr);
		}
		return protocol;
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -