Here you can find the source of toFileName(InetSocketAddress address)
Parameter | Description |
---|---|
address | Address. |
public static String toFileName(InetSocketAddress address)
//package com.java2s; /*//from w w w . ja v a 2s . c om * Copyright 2019 The Hekate Project * * The Hekate Project licenses this file to you 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.net.InetSocketAddress; public class Main { /** Prefix for the file name of {@link #toFileName(InetSocketAddress)}. */ public static final String FILE_PREFIX = "node_"; /** Separator of host and port components for {@link #toFileName(InetSocketAddress)}. */ public static final String PORT_SEPARATOR = "_"; /** * Converts the specified address into a string that is suitable for naming files. * * @param address Address. * * @return File name. * * @see #fromFileName(String, Logger) */ public static String toFileName(InetSocketAddress address) { return FILE_PREFIX + address.getAddress().getHostAddress() + PORT_SEPARATOR + address.getPort(); } }