Java Network Interface Get printValidInterfaces(PrintWriter pout)

Here you can find the source of printValidInterfaces(PrintWriter pout)

Description

Prints out all the NetworkInterface names available on this machine as a list.

License

Apache License

Parameter

Parameter Description
pout a parameter

Declaration

public static void printValidInterfaces(PrintWriter pout) throws IOException 

Method Source Code


//package com.java2s;
/*/* w  w  w. j  ava2 s . c o m*/
 * Mckoi Software ( http://www.mckoi.com/ )
 * Copyright (C) 2000 - 2015  Diehl and Associates, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import java.io.IOException;
import java.io.PrintWriter;
import java.net.NetworkInterface;
import java.util.Enumeration;

public class Main {
    /**
     * Prints out all the NetworkInterface names available on this machine as
     * a list.
     * 
     * @param pout
     */
    public static void printValidInterfaces(PrintWriter pout) throws IOException {

        Enumeration<NetworkInterface> network_interfaces = NetworkInterface.getNetworkInterfaces();
        while (network_interfaces.hasMoreElements()) {
            NetworkInterface net_if = network_interfaces.nextElement();
            pout.println("  " + net_if.getName());
        }

    }
}

Related

  1. isActive(String niName)
  2. isNixMashPC()
  3. parseInterfaceList(String s)
  4. pingFromInterface(String name)
  5. print(Collection objs)
  6. toNI(String niName)