当前位置: 首页>>代码示例>>Java>>正文


Java Tokenizer类代码示例

本文整理汇总了Java中com.trilead.ssh2.util.Tokenizer的典型用法代码示例。如果您正苦于以下问题:Java Tokenizer类的具体用法?Java Tokenizer怎么用?Java Tokenizer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Tokenizer类属于com.trilead.ssh2.util包,在下文中一共展示了Tokenizer类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseIPv4Address

import com.trilead.ssh2.util.Tokenizer; //导入依赖的package包/类
private InetAddress parseIPv4Address(String host) throws UnknownHostException
{
	if (host == null)
		return null;

	String[] quad = Tokenizer.parseTokens(host, '.');

	if ((quad == null) || (quad.length != 4))
		return null;

	byte[] addr = new byte[4];

	for (int i = 0; i < 4; i++)
	{
		int part = 0;

		if ((quad[i].length() == 0) || (quad[i].length() > 3))
			return null;

		for (int k = 0; k < quad[i].length(); k++)
		{
			char c = quad[i].charAt(k);

			/* No, Character.isDigit is not the same */
			if ((c < '0') || (c > '9'))
				return null;

			part = part * 10 + (c - '0');
		}

		if (part > 255) /* 300.1.2.3 is invalid =) */
			return null;

		addr[i] = (byte) part;
	}

	return InetAddress.getByAddress(host, addr);
}
 
开发者ID:dragonlinux,项目名称:connectbot,代码行数:39,代码来源:TransportManager.java

示例2: parseIPv4Address

import com.trilead.ssh2.util.Tokenizer; //导入依赖的package包/类
private static InetAddress parseIPv4Address(String host) throws UnknownHostException
{
	if (host == null)
		return null;

	String[] quad = Tokenizer.parseTokens(host, '.');

	if ((quad == null) || (quad.length != 4))
		return null;

	byte[] addr = new byte[4];

	for (int i = 0; i < 4; i++)
	{
		int part = 0;

		if ((quad[i].length() == 0) || (quad[i].length() > 3))
			return null;

		for (int k = 0; k < quad[i].length(); k++)
		{
			char c = quad[i].charAt(k);

			/* No, Character.isDigit is not the same */
			if ((c < '0') || (c > '9'))
				return null;

			part = part * 10 + (c - '0');
		}

		if (part > 255) /* 300.1.2.3 is invalid =) */
			return null;

		addr[i] = (byte) part;
	}

	return InetAddress.getByAddress(host, addr);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:TransportManager.java

示例3: parseIPv4Address

import com.trilead.ssh2.util.Tokenizer; //导入依赖的package包/类
private InetAddress parseIPv4Address(String host)
		throws UnknownHostException {
	if (host == null)
		return null;

	String[] quad = Tokenizer.parseTokens(host, '.');

	if ((quad == null) || (quad.length != 4))
		return null;

	byte[] addr = new byte[4];

	for (int i = 0; i < 4; i++) {
		int part = 0;

		if ((quad[i].length() == 0) || (quad[i].length() > 3))
			return null;

		for (int k = 0; k < quad[i].length(); k++) {
			char c = quad[i].charAt(k);

			/* No, Character.isDigit is not the same */
			if ((c < '0') || (c > '9'))
				return null;

			part = part * 10 + (c - '0');
		}

		if (part > 255) /* 300.1.2.3 is invalid =) */
			return null;

		addr[i] = (byte) part;
	}

	return InetAddress.getByAddress(host, addr);
}
 
开发者ID:jianlinwei,项目名称:sshtunnel,代码行数:37,代码来源:TransportManager.java

示例4: readNameList

import com.trilead.ssh2.util.Tokenizer; //导入依赖的package包/类
public String[] readNameList() throws IOException
{
	return Tokenizer.parseTokens(readString(), ',');
}
 
开发者ID:dragonlinux,项目名称:connectbot,代码行数:5,代码来源:TypesReader.java

示例5: readNameList

import com.trilead.ssh2.util.Tokenizer; //导入依赖的package包/类
public String[] readNameList() throws IOException {
	return Tokenizer.parseTokens(readString(), ',');
}
 
开发者ID:jianlinwei,项目名称:sshtunnel,代码行数:4,代码来源:TypesReader.java


注:本文中的com.trilead.ssh2.util.Tokenizer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。