我有一个独立的Java应用程序,它通过SNMP陷阱接收SNMP消息.我在我的应用程序中使用SNMP4J库.在收到的SNMP消息中,我需要将十六进制格式的事件时间字段转换为人类可读的格式.通常收到的事件时间字段如下所示:
I have a stand alone java application that receives SNMP messages via an SNMP trap. I am using SNMP4J library in my application. In the SNMP message received, I need to convert the event time field, which is in hexadecimal format, into a human readable format. The event time field received normally looks as follows for example:
eventTime*SNMPv2-SMI::enterprises.193.183.4.1.4.5.1.7.0 = Hex-STRING: 07 DC 03 0C 12 15 2C 1F 2B 01 00有人能告诉我如何借助或不借助SNMP4J库将文本'07 DC 03 0C 12 15 2C 1F 2B 01 00'转换为人类可读的日期时间值?谢谢.
Can anyone tell me how I can convert the text '07 DC 03 0C 12 15 2C 1F 2B 01 00' into a human readable datetime value with or without the help of SNMP4J library? Thanks.
推荐答案您可以使用Integer.parseInt("07dc",16)并弹出2012年流行音乐,因此这应该给您一些暗示,剩下的就是确保您会自己弄清楚这是否确实是这一年.
you can use Integer.parseInt("07dc", 16) and out 2012 pops, so this should give a hint of the year, the rest i'm sure you will figure out by yourself if this is indeed the year.
更多推荐
Java中人类可读格式的SNMP EventTime
发布评论