當前位置: 首頁>>代碼示例>>Java>>正文


Java StringUtil.simpleClassName方法代碼示例

本文整理匯總了Java中io.netty.util.internal.StringUtil.simpleClassName方法的典型用法代碼示例。如果您正苦於以下問題:Java StringUtil.simpleClassName方法的具體用法?Java StringUtil.simpleClassName怎麽用?Java StringUtil.simpleClassName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在io.netty.util.internal.StringUtil的用法示例。


在下文中一共展示了StringUtil.simpleClassName方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getEncodedTargetAddress

import io.netty.util.internal.StringUtil; //導入方法依賴的package包/類
private ByteBuf getEncodedTargetAddress(ByteBufAllocator allocator, boolean resolve) throws ProxyConnectException {
    InetSocketAddress remoteAddress = destinationAddress();
    SocksAddressType remoteAddressType;
    String remoteHost;
    if (!resolve || remoteAddress.isUnresolved()) {
        remoteAddressType = SocksAddressType.DOMAIN;
        remoteHost = remoteAddress.getHostString();
    } else {
        remoteHost = remoteAddress.getAddress().getHostAddress();
        if (NetUtil.isValidIpV4Address(remoteHost)) {
            remoteAddressType = SocksAddressType.IPv4;
        } else if (NetUtil.isValidIpV6Address(remoteHost)) {
            remoteAddressType = SocksAddressType.IPv6;
        } else {
            throw new ProxyConnectException("unknown address type: " + StringUtil.simpleClassName(remoteHost));
        }
    }
    int remotePort = remoteAddress.getPort();
    SocksCmdRequest request = new SocksCmdRequest(SocksCmdType.UNKNOWN, remoteAddressType, remoteHost, remotePort);
    return SSocksAddressEncoder.INSTANCE.encode(allocator, request);
}
 
開發者ID:tridays,項目名稱:netty-socks,代碼行數:22,代碼來源:SSocksConnectHandler.java

示例2: toPoolName

import io.netty.util.internal.StringUtil; //導入方法依賴的package包/類
public static String toPoolName(Class<?> poolType) {
    if (poolType == null) {
        throw new NullPointerException("poolType");
    }

    String poolName = StringUtil.simpleClassName(poolType);
    switch (poolName.length()) {
        case 0:
            return "unknown";
        case 1:
            return poolName.toLowerCase(Locale.US);
        default:
            if (Character.isUpperCase(poolName.charAt(0)) && Character.isLowerCase(poolName.charAt(1))) {
                return Character.toLowerCase(poolName.charAt(0)) + poolName.substring(1);
            } else {
                return poolName;
            }
    }
}
 
開發者ID:venus-boot,項目名稱:saluki,代碼行數:20,代碼來源:NamedThreadFactory.java

示例3: filterOutboundMessage

import io.netty.util.internal.StringUtil; //導入方法依賴的package包/類
@Override
protected Object filterOutboundMessage(Object msg) {
    if (msg instanceof UkcpPacket) {
        UkcpPacket p = (UkcpPacket) msg;
        ByteBuf content = p.content();
        if (isSingleDirectBuffer(content)) {
            return p;
        }
        content.retain(); // newDirectBuffer method call release method of content
        UkcpPacket np = UkcpPacket.newInstance(newDirectBuffer(content), p.remoteAddress());
        p.release();
        return np;
    }

    throw new UnsupportedOperationException(
            "unsupported message type: " + StringUtil.simpleClassName(msg) + EXPECTED_TYPES);
}
 
開發者ID:szhnet,項目名稱:kcp-netty,代碼行數:18,代碼來源:UkcpServerChannel.java

示例4: find

import io.netty.util.internal.StringUtil; //導入方法依賴的package包/類
/**
 * Finds and creates Parser instances from the specified Class.
 *
 * @param clazz The Class to find the Parser instance within.
 * @param path The path to the Parsers source file.
 * @return The created Parser instance.
 * @throws NoSuchMethodException If there was no constructor found for the specified parameters.
 * @throws InvocationTargetException If the Parsers constructor throws an exception.
 * @throws IllegalAccessException If the Parsers constructor object is enforcing Java language access control and
 *             the underlying constructor is inaccessible.
 * @throws InstantiationException If the Parser is an abstract class.
 */
private Parser<?, ?> find(Class<Parser<?, ?>> clazz, String path) throws InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {
	Constructor<?>[] constructors = clazz.getConstructors();

	for (Constructor<?> constructor : constructors) {
		Class<?>[] params = constructor.getParameterTypes();

		switch (params.length) {
			case 1:
				Class<?> parameter = path == null ? context.getClass() : path.getClass();
				Object argument = path == null ? context : path;

				return clazz.getConstructor(parameter).newInstance(argument);
			case 2:
				return clazz.getConstructor(String.class, ServerContext.class).newInstance(path, context);
		}
	}

	String className = StringUtil.simpleClassName(clazz);
	throw new NoSuchMethodException("Unable to find suitable constructor, only " + className + "(String), " + className + "(ServerContext) or " + className + "(String, ServerContext) are permitted.");
}
 
開發者ID:atomicint,項目名稱:brandywine,代碼行數:33,代碼來源:ParserTomlParser.java

示例5: toPoolName

import io.netty.util.internal.StringUtil; //導入方法依賴的package包/類
private static String toPoolName(Class<?> poolType) {
    if (poolType == null) {
        throw new NullPointerException("poolType");
    }

    String poolName = StringUtil.simpleClassName(poolType);
    switch (poolName.length()) {
        case 0:
            return "unknown";
        case 1:
            return poolName.toLowerCase(Locale.US);
        default:
            if (Character.isUpperCase(poolName.charAt(0)) && Character.isLowerCase(poolName.charAt(1))) {
                return Character.toLowerCase(poolName.charAt(0)) + poolName.substring(1);
            } else {
                return poolName;
            }
    }
}
 
開發者ID:wuyinxian124,項目名稱:netty4.0.27Learn,代碼行數:20,代碼來源:DefaultThreadFactory.java

示例6: register

import io.netty.util.internal.StringUtil; //導入方法依賴的package包/類
static LocalAddress register(
        Channel channel, LocalAddress oldLocalAddress, SocketAddress localAddress) {
    if (oldLocalAddress != null) {
        throw new ChannelException("already bound");
    }
    if (!(localAddress instanceof LocalAddress)) {
        throw new ChannelException("unsupported address type: " + StringUtil.simpleClassName(localAddress));
    }

    LocalAddress addr = (LocalAddress) localAddress;
    if (LocalAddress.ANY.equals(addr)) {
        addr = new LocalAddress(channel);
    }

    Channel boundChannel = boundChannels.putIfAbsent(addr, channel);
    if (boundChannel != null) {
        throw new ChannelException("address already in use by: " + boundChannel);
    }
    return addr;
}
 
開發者ID:wuyinxian124,項目名稱:netty4.0.27Learn,代碼行數:21,代碼來源:LocalChannelRegistry.java

示例7: toString

import io.netty.util.internal.StringUtil; //導入方法依賴的package包/類
@Override
public String toString() {
    if (refCnt() == 0) {
        return StringUtil.simpleClassName(this) + "(freed)";
    }

    StringBuilder buf = new StringBuilder()
        .append(StringUtil.simpleClassName(this))
        .append("(ridx: ").append(readerIndex)
        .append(", widx: ").append(writerIndex)
        .append(", cap: ").append(capacity());
    if (maxCapacity != Integer.MAX_VALUE) {
        buf.append('/').append(maxCapacity);
    }

    ByteBuf unwrapped = unwrap();
    if (unwrapped != null) {
        buf.append(", unwrapped: ").append(unwrapped);
    }
    buf.append(')');
    return buf.toString();
}
 
開發者ID:wuyinxian124,項目名稱:netty4.0.27Learn,代碼行數:23,代碼來源:AbstractByteBuf.java

示例8: doWrite

import io.netty.util.internal.StringUtil; //導入方法依賴的package包/類
@Override
protected void doWrite(ChannelOutboundBuffer in) throws Exception {
    for (;;) {
        final Object o = in.current();
        if (o == null) {
            break;
        }
        // TODO
        if (o instanceof CanFrame) {
            socket.send((CanFrame) o);
            in.remove();
        } else {
            throw new UnsupportedOperationException("unsupported message type: " + StringUtil.simpleClassName(o));
        }
    }
}
 
開發者ID:jazdw,項目名稱:jnaCan,代碼行數:17,代碼來源:Tp20Channel.java

示例9: toString

import io.netty.util.internal.StringUtil; //導入方法依賴的package包/類
@Override
public String toString() {
    return StringUtil.simpleClassName(this)
            + '['
            + "grantedQoSLevels=" + ArrayUtils.toString(grantedQoSLevels)
            + ']';
}
 
開發者ID:12315jack,項目名稱:j1st-mqtt,代碼行數:8,代碼來源:MqttSubAckPayload.java

示例10: toString

import io.netty.util.internal.StringUtil; //導入方法依賴的package包/類
@Override
public String toString() {
    return StringUtil.simpleClassName(this)
            + '['
            + "topic=" + topicName
            + ", packetId=" + packetId
            + ']';
}
 
開發者ID:12315jack,項目名稱:j1st-mqtt,代碼行數:9,代碼來源:MqttPublishVariableHeader.java

示例11: toString

import io.netty.util.internal.StringUtil; //導入方法依賴的package包/類
@Override
public String toString() {
    return StringUtil.simpleClassName(this)
            + '['
            + "messageType=" + messageType
            + ", dup=" + dup
            + ", qos=" + qos
            + ", retain=" + retain
            + ", remainingLength=" + remainingLength
            + ']';
}
 
開發者ID:12315jack,項目名稱:j1st-mqtt,代碼行數:12,代碼來源:MqttFixedHeader.java

示例12: toString

import io.netty.util.internal.StringUtil; //導入方法依賴的package包/類
@Override
public String toString() {
    return StringUtil.simpleClassName(this)
            + '['
            + "subscriptions=" + ArrayUtils.toString(subscriptions)
            + ']';
}
 
開發者ID:12315jack,項目名稱:j1st-mqtt,代碼行數:8,代碼來源:MqttSubscribePayload.java

示例13: toString

import io.netty.util.internal.StringUtil; //導入方法依賴的package包/類
@Override
public String toString() {
    return StringUtil.simpleClassName(this)
            + '['
            + "fixedHeader=" + (fixedHeader != null ? fixedHeader.toString() : "")
            + ", variableHeader=" + (variableHeader != null ? variableHeader.toString() : "")
            + ", payload=" + (payload != null ? payload.toString() : "")
            + ']';
}
 
開發者ID:12315jack,項目名稱:j1st-mqtt,代碼行數:10,代碼來源:MqttMessage.java

示例14: toString

import io.netty.util.internal.StringUtil; //導入方法依賴的package包/類
@Override
public String toString() {
    return StringUtil.simpleClassName(this)
            + '['
            + "packetId=" + packetId
            + ']';
}
 
開發者ID:12315jack,項目名稱:j1st-mqtt,代碼行數:8,代碼來源:MqttPacketIdVariableHeader.java

示例15: toString

import io.netty.util.internal.StringUtil; //導入方法依賴的package包/類
@Override
public String toString() {
    return StringUtil.simpleClassName(this)
            + '['
            + "topic=" + topic
            + ", requestedQos=" + requestedQos
            + ']';
}
 
開發者ID:12315jack,項目名稱:j1st-mqtt,代碼行數:9,代碼來源:MqttTopicSubscription.java


注:本文中的io.netty.util.internal.StringUtil.simpleClassName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。