Here you can find the source of typeToInt(String type)
static int typeToInt(String type)
//package com.java2s; /*//w w w.j ava2 s .c o m async-net: A basic asynchronous network library, based on netty Copyright (C) 2016 melchor629 (melchor9000@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ public class Main { static int typeToInt(String type) { switch (type) { case "A": return 1; case "NS": return 2; case "MD": return 3; case "MF": return 4; case "CNAME": return 5; case "SOA": return 6; case "MB": return 7; case "MG": return 8; case "MR": return 9; case "NULL": return 10; case "WKS": return 11; case "PTR": return 12; case "HINFO": return 13; case "MINFO": return 14; case "MX": return 15; case "TXT": return 16; case "AAAA": return 28; default: throw new IllegalArgumentException("Invalid type " + type); } } }