本文整理汇总了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();
}
示例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();
}
}
示例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);
}
}
示例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();
}
}
示例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();
}
}