Java中人类可读格式的SNMP EventTime [英] SNMP EventTime in Human Readable format in Java

查看:76
本文介绍了Java中人类可读格式的SNMP EventTime的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个独立的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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆