All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.litongjava.tio.websocket.common.Opcode Maven / Gradle / Ivy

There is a newer version: 3.7.3.v20241201-RELEASE
Show newest version
package com.litongjava.tio.websocket.common;

import java.util.HashMap;
import java.util.Map;

/**
 * @author tanyaowu
 * 2017年6月30日 下午5:06:09
 */
public enum Opcode {

  NOT_FIN((byte) 0), TEXT((byte) 1), BINARY((byte) 2), CLOSE((byte) 8), PING((byte) 9), PONG((byte) 10);

	private static final Map map = new HashMap<>();

	static {
		for (Opcode command : values()) {
			map.put(command.getCode(), command);
		}
	}

	public static Opcode valueOf(byte code) {
		return map.get(code);
	}

	private final byte code;

	private Opcode(byte code) {
		this.code = code;
	}

	public byte getCode() {
		return code;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy