本文整理匯總了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);
}
示例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;
}
}
}
示例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);
}
示例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.");
}
示例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;
}
}
}
示例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;
}
示例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();
}
示例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));
}
}
}
示例9: toString
import io.netty.util.internal.StringUtil; //導入方法依賴的package包/類
@Override
public String toString() {
return StringUtil.simpleClassName(this)
+ '['
+ "grantedQoSLevels=" + ArrayUtils.toString(grantedQoSLevels)
+ ']';
}
示例10: toString
import io.netty.util.internal.StringUtil; //導入方法依賴的package包/類
@Override
public String toString() {
return StringUtil.simpleClassName(this)
+ '['
+ "topic=" + topicName
+ ", packetId=" + packetId
+ ']';
}
示例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
+ ']';
}
示例12: toString
import io.netty.util.internal.StringUtil; //導入方法依賴的package包/類
@Override
public String toString() {
return StringUtil.simpleClassName(this)
+ '['
+ "subscriptions=" + ArrayUtils.toString(subscriptions)
+ ']';
}
示例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() : "")
+ ']';
}
示例14: toString
import io.netty.util.internal.StringUtil; //導入方法依賴的package包/類
@Override
public String toString() {
return StringUtil.simpleClassName(this)
+ '['
+ "packetId=" + packetId
+ ']';
}
示例15: toString
import io.netty.util.internal.StringUtil; //導入方法依賴的package包/類
@Override
public String toString() {
return StringUtil.simpleClassName(this)
+ '['
+ "topic=" + topic
+ ", requestedQos=" + requestedQos
+ ']';
}