Java Formatter Usage showVxlanHeaderOutput()

Here you can find the source of showVxlanHeaderOutput()

Description

show Vxlan Header Output

License

Open Source License

Declaration

public static void showVxlanHeaderOutput() 

Method Source Code

//package com.java2s;
/*// w ww  .  j  a va 2s . c o  m
 * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */

import java.util.Formatter;

public class Main {
    private static final String VXLAN_OUTPUT_FORMAT = "%-24s %-24s %-18s %-5s";
    private static final String VXLAN_OUTPUT_FORMAT_LINE1 = "%-49s %-45s";

    public static void showVxlanHeaderOutput() {
        StringBuilder sb = new StringBuilder();
        Formatter fmt = new Formatter(sb);
        System.out.println(fmt.format(VXLAN_OUTPUT_FORMAT_LINE1, "Name",
                "Description"));
        sb.setLength(0);
        System.out.println(fmt.format(VXLAN_OUTPUT_FORMAT, "Local IP",
                "Remote IP", "Gateway IP", "AdmState"));
        sb.setLength(0);
        System.out.println(fmt.format(VXLAN_OUTPUT_FORMAT, "OpState",
                "Parent", "Tag", ""));
        sb.setLength(0);
        System.out
                .println(fmt
                        .format("--------------------------------------------------------------------------------"));
        fmt.close();
    }
}

Related

  1. listToString(List list, String separator)
  2. long2Mac(final long macAddress)
  3. millisToHumanTime(long milliseconds)
  4. msToHumanReadableDelta(long start)
  5. numberWithLeadingZeroes(int n, int totalChars)
  6. substitution(Formatter formatter, int flags, int width, int precision, StringBuilder obj)
  7. toHexString(final byte[] data)
  8. toReadableSize(long bytes)
  9. toTwoDigit(double f)