comparison src/goodjava/io/IoUtils.java @ 1698:2dbcc8360a3e

backup security
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 27 Jun 2022 20:51:49 -0600
parents 08177ced7fa0
children 745f756e719b
comparison
equal deleted inserted replaced
1697:aff2309ae510 1698:2dbcc8360a3e
6 import java.io.Reader; 6 import java.io.Reader;
7 import java.io.InputStreamReader; 7 import java.io.InputStreamReader;
8 import java.io.Writer; 8 import java.io.Writer;
9 import java.io.StringWriter; 9 import java.io.StringWriter;
10 import java.io.IOException; 10 import java.io.IOException;
11 import java.net.InetAddress;
12 import java.net.Inet4Address;
13 import java.net.NetworkInterface;
11 import java.nio.file.Files; 14 import java.nio.file.Files;
12 import java.nio.file.attribute.FileTime; 15 import java.nio.file.attribute.FileTime;
13 import java.security.Security; 16 import java.security.Security;
17 import java.util.Set;
18 import java.util.HashSet;
19 import java.util.Enumeration;
14 import javax.net.ssl.SSLSocketFactory; 20 import javax.net.ssl.SSLSocketFactory;
15 import javax.net.ssl.SSLServerSocketFactory; 21 import javax.net.ssl.SSLServerSocketFactory;
16 import goodjava.logging.Logger; 22 import goodjava.logging.Logger;
17 import goodjava.logging.LoggerFactory; 23 import goodjava.logging.LoggerFactory;
18 24
101 } 107 }
102 in.close(); 108 in.close();
103 return cs; 109 return cs;
104 } 110 }
105 111
112 public static Set<InetAddress> getInetAddresses() throws IOException {
113 Set<InetAddress> set = new HashSet<InetAddress>();
114 for( Enumeration<NetworkInterface> e1 = NetworkInterface.getNetworkInterfaces(); e1.hasMoreElements(); ) {
115 NetworkInterface ni = e1.nextElement();
116 for( Enumeration<InetAddress> e2 = ni.getInetAddresses(); e2.hasMoreElements(); ) {
117 InetAddress ia = e2.nextElement();
118 set.add(ia);
119 }
120 }
121 return set;
122 }
106 123
107 124
108 public static class ProcException extends IOException { 125 public static class ProcException extends IOException {
109 private ProcException(String msg) { 126 private ProcException(String msg) {
110 super(msg); 127 super(msg);