io.netty.resolver.HostsFileParser.class Maven / Gradle / Ivy
???? 2 !io/netty/resolver/HostsFileParser java/lang/Object HostsFileParser.java WINDOWS_DEFAULT_SYSTEM_ROOT Ljava/lang/String;
C:\Windows WINDOWS_HOSTS_FILE_RELATIVE_PATH \system32\drivers\etc\hosts X_PLATFORMS_HOSTS_FILE_PATH
/etc/hosts WHITESPACES Ljava/util/regex/Pattern; logger /Lio/netty/util/internal/logging/InternalLogger; locateHostsFile ()Ljava/io/File; (io/netty/util/internal/PlatformDependent isWindows ()Z
java/io/File java/lang/StringBuilder ()V !
"
SystemRoot $ java/lang/System & getenv &(Ljava/lang/String;)Ljava/lang/String; ( )
' * append -(Ljava/lang/String;)Ljava/lang/StringBuilder; , -
. toString ()Ljava/lang/String; 0 1
2 (Ljava/lang/String;)V 4
5 exists 7
8 %C:\Windows\system32\drivers\etc\hosts : hostsFile Ljava/io/File;
parseSilently &()Lio/netty/resolver/HostsFileEntries; java/io/IOException @
B parse 4(Ljava/io/File;)Lio/netty/resolver/HostsFileEntries; D E
F H 'Failed to load and parse hosts file at J getPath L 1
M -io/netty/util/internal/logging/InternalLogger O warn *(Ljava/lang/String;Ljava/lang/Throwable;)V Q R P S "io/netty/resolver/HostsFileEntries U EMPTY $Lio/netty/resolver/HostsFileEntries; W X V Y e Ljava/io/IOException; file ] !io/netty/util/internal/ObjectUtil _ checkNotNull 8(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object; a b
` c isFile e
f java/io/BufferedReader h java/io/FileReader j (Ljava/io/File;)V l
k m (Ljava/io/Reader;)V o
i p 6(Ljava/io/Reader;)Lio/netty/resolver/HostsFileEntries; D r
s reader u java/util/HashMap w
x "
java/util/Map z readLine | 1
i } java/lang/String indexOf (I)I ? ?
? ? substring (II)Ljava/lang/String; ? ?
? ? trim ? 1
? ? isEmpty ?
? ? java/util/ArrayList ?
? " ? java/util/regex/Pattern ? split -(Ljava/lang/CharSequence;)[Ljava/lang/String; ? ?
? ? java/io/Reader ? java/util/List ? [Ljava/lang/String; ? add (Ljava/lang/Object;)Z ? ? ? ? size ()I ? ? ? ? get (I)Ljava/lang/Object; ? ? ? ? io/netty/util/NetUtil ? "createByteArrayFromIpAddressString (Ljava/lang/String;)[B ? ?
? ? [B ? java/util/Locale ? ENGLISH Ljava/util/Locale; ? ? ? ? toLowerCase &(Ljava/util/Locale;)Ljava/lang/String; ? ?
? ? java/net/InetAddress ? getByAddress ,(Ljava/lang/String;[B)Ljava/net/InetAddress; ? ?
? ? java/net/Inet4Address ? put 8(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; ? ? { ? java/net/Inet6Address ? { ? !(Ljava/util/Map;Ljava/util/Map;)V ?
V ? close ? !
i ? Failed to close a reader ? java/lang/Throwable ? s previous Ljava/net/Inet4Address; Ljava/net/Inet6Address; hostname
hostnameLower address Ljava/net/InetAddress; i I commentPosition lineParts $Ljava/util/List; Ljava/util/List; ipBytes ipv4Entries :Ljava/util/Map; Ljava/util/Map; ipv6Entries :Ljava/util/Map; line Ljava/io/Reader; buff Ljava/io/BufferedReader;
" this #Lio/netty/resolver/HostsFileParser; [ ]+ ? compile -(Ljava/lang/String;)Ljava/util/regex/Pattern; ? ?
? ? 4io/netty/util/internal/logging/InternalLoggerFactory ? getInstance B(Ljava/lang/Class;)Lio/netty/util/internal/logging/InternalLogger; ? ?
? ?
ConstantValue Code LocalVariableTable LineNumberTable
StackMapTable
Exceptions LocalVariableTypeTable
SourceFile 1 ?
?
?
? E? ? 6? Y? Y? #%? +? /? /? 3? 6K*? 9? ? Y;? 6K?
? Y? 6K*? % <