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


Java JField.getStyle方法代码示例

本文整理汇总了Java中org.jnetpcap.packet.structure.JField.getStyle方法的典型用法代码示例。如果您正苦于以下问题:Java JField.getStyle方法的具体用法?Java JField.getStyle怎么用?Java JField.getStyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jnetpcap.packet.structure.JField的用法示例。


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

示例1: fieldAfter

import org.jnetpcap.packet.structure.JField; //导入方法依赖的package包/类
/** 
 * @param header
 * @param field
 * @param detail
 * @throws IOException
 * @see org.jnetpcap.packet.format.JFormatter#fieldAfter(org.jnetpcap.packet.JHeader, org.jnetpcap.packet.structure.JField, org.jnetpcap.packet.format.JFormatter.Detail)
 */
@Override
protected void fieldAfter(JHeader header, JField field, Detail detail)
		throws IOException {

	if (field.getStyle() == Style.BYTE_ARRAY_HEX_DUMP) {
		decLevel();
		pad().format(LT + "/hexdump" + GT + "\n");
	} /*
		 * else if (false && field.hasSubFields()) { final String v =
		 * stylizeSingleLine(header, field, field.getValue(header));
		 * 
		 * pad().format(LT + "/field" + GT);
		 * 
		 * }
		 */else if (field.getStyle() == Style.INT_BITS) {
	}

	decLevel();
}
 
开发者ID:pvenne,项目名称:jgoose,代码行数:27,代码来源:XmlFormatter.java

示例2: stylizeSingleLine

import org.jnetpcap.packet.structure.JField; //导入方法依赖的package包/类
/**
 * Stylize single line.
 * 
 * @param header
 *          the header
 * @param field
 *          the field
 * @param value
 *          the value
 * @return the string
 */
protected String stylizeSingleLine(JHeader header, JField field, Object value) {

	final Style style = field.getStyle();

	switch (style) {
	case BYTE_ARRAY_DASH_ADDRESS:
		return FormatUtils.asString((byte[]) value, '-').toUpperCase();

	case BYTE_ARRAY_COLON_ADDRESS:
		return formatMacAddress((byte[]) value);

	case BYTE_ARRAY_DOT_ADDRESS:
		return FormatUtils.asString((byte[]) value, '.').toUpperCase();

	case BYTE_ARRAY_ARRAY_IP4_ADDRESS:
	case BYTE_ARRAY_IP4_ADDRESS:
	case BYTE_ARRAY_IP6_ADDRESS:
		return formatIpAddress((byte[]) value);

	case INT_BITS:
		return stylizeBitField(header, field, value);

	case INT_RADIX_16:
		return Long.toHexString(((Number) value).longValue()).toUpperCase();

	case INT_HEX:
		return "0x"
				+ Long.toHexString(((Number) value).longValue()).toUpperCase() + " ("
				+ value.toString() + ")";

	case LONG_HEX:
		return "0x" + Long.toHexString((long) (Long) value).toUpperCase() + " ("
				+ value.toString() + ")";

	default:
		return value.toString();
	}
}
 
开发者ID:GlacialSoftware,项目名称:PCAPReader,代码行数:50,代码来源:JFormatter.java

示例3: stylizeSingleLine

import org.jnetpcap.packet.structure.JField; //导入方法依赖的package包/类
/**
 * Stylize single line.
 * 
 * @param header
 *            the header
 * @param field
 *            the field
 * @param value
 *            the value
 * @return the string
 */
protected String stylizeSingleLine(JHeader header, JField field,
		Object value) {

	final Style style = field.getStyle();

	switch (style) {
		case BYTE_ARRAY_DASH_ADDRESS :
			return FormatUtils.asString((byte[]) value, '-').toUpperCase();

		case BYTE_ARRAY_COLON_ADDRESS :
			return formatMacAddress((byte[]) value);

		case BYTE_ARRAY_DOT_ADDRESS :
			return FormatUtils.asString((byte[]) value, '.').toUpperCase();

		case BYTE_ARRAY_ARRAY_IP4_ADDRESS :
		case BYTE_ARRAY_IP4_ADDRESS :
		case BYTE_ARRAY_IP6_ADDRESS :
			return formatIpAddress((byte[]) value);

		case BYTE_ARRAY_OCTET_STREAM :
			return FormatUtils.hexLineStream((byte[]) value, 0);

		case INT_BITS :
			return stylizeBitField(header, field, value);

		case INT_RADIX_16 :
			return Long.toHexString(((Number) value).longValue())
					.toUpperCase();

		case INT_HEX :
			long v = (value instanceof Long)
					? ((Number) value).longValue()
					: toUInt(((Number) value).intValue());
			return "0x" + Long.toHexString(v).toUpperCase() + " ("
					+ ((Long) v).toString() + ")";

		case LONG_HEX :
			return "0x" + Long.toHexString((Long) value).toUpperCase()
					+ " (" + value.toString() + ")";

		case TIMESTAMP :
			return new Timestamp((Long) value).toString();

		case TIMESTAMP_SECONDS :
			return new Timestamp(((Long) value) * 1000).toString();

		default :
			return String.valueOf(value);
	}
}
 
开发者ID:pvenne,项目名称:jgoose,代码行数:63,代码来源:JFormatter.java

示例4: fieldAfter

import org.jnetpcap.packet.structure.JField; //导入方法依赖的package包/类
/**
 * Field after.
 * 
 * @param header
 *            the header
 * @param field
 *            the field
 * @param detail
 *            the detail
 * @throws IOException
 *             Signals that an I/O exception has occurred.
 * @see org.jnetpcap.packet.format.JFormatter#fieldAfter(org.jnetpcap.packet.JHeader,
 *      org.jnetpcap.packet.structure.JField,
 *      org.jnetpcap.packet.format.JFormatter.Detail)
 */
@Override
protected void fieldAfter(JHeader header, JField field, Detail detail)
		throws IOException {

	if (field.getStyle() == Style.INT_BITS) {

	} else if (field.hasSubFields()) {
		decLevel();
	} else if (field.getStyle() != Style.BYTE_ARRAY_HEX_DUMP
			&& field.getStyle() != Style.STRING_TEXT_DUMP) {
		decLevel();
	}
}
 
开发者ID:pvenne,项目名称:jgoose,代码行数:29,代码来源:TextFormatter.java

示例5: fieldAfter

import org.jnetpcap.packet.structure.JField; //导入方法依赖的package包/类
/**
 * Field after.
 * 
 * @param header
 *          the header
 * @param field
 *          the field
 * @param detail
 *          the detail
 * @throws IOException
 *           Signals that an I/O exception has occurred.
 * @see org.jnetpcap.packet.format.JFormatter#fieldAfter(org.jnetpcap.packet.JHeader,
 *      org.jnetpcap.packet.structure.JField,
 *      org.jnetpcap.packet.format.JFormatter.Detail)
 */
protected void fieldAfter(JHeader header, JField field, Detail detail)
    throws IOException {

	if (field.getStyle() == Style.INT_BITS) {

	} else if (field.hasSubFields()) {
		decLevel();
	} else if (field.getStyle() != Style.BYTE_ARRAY_HEX_DUMP
	    && field.getStyle() != Style.STRING_TEXT_DUMP) {
		decLevel();
	}
}
 
开发者ID:GlacialSoftware,项目名称:PCAPReader,代码行数:28,代码来源:TextFormatter.java


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