有没有用于二进制文件解析的Java框架? [英] Are there any Java Frameworks for binary file parsing?

查看:259
本文介绍了有没有用于二进制文件解析的Java框架?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是,我想用一个在JAVA中实现的通用解析器来解析不同类型的二进制文件。也许用分析器读取的配置文件描述文件格式,或者根据某种解析规则创建解析文件的Java类。



在网上找到了一点,但在这个主题上几乎找不到任何东西。



我发现的只是处理编译器生成器(Jay,Cojen等)我不认为我可以使用它们来生成解析二进制文件的东西。但是我可能在这个假设是错的。

是否有任何框架,特别是处理二进制文件的简单解析或任何人都可以给我一个提示,我可以使用解析器/编译器生成器这样做吗?

$更新:
我正在寻找的东西,我可以写一个配置文件

  file:
header:FIXED(MAGIC)
body:content(10)

content:
value1:BYTE
value2:LONG
value3:STRING(10)

,它会自动生成一些分析以MAGIC开始的文件,然后是content-package(它本身由一个字节,一个长和一个10字节的字符串)。

Update2
我发现了一些可比的东西, /construct.wikispaces.com/rel =nofollow noreferrer>构造,但遗憾的是这是一个Python框架。也许这可以帮助别人得到一个想法,我在找什么。

试试看 preon


My problem is, that I want to parse binary files of different types with a generic parser which is implemented in JAVA. Maybe describing the file format with a configuration file which is read by the parser or creating Java classes which parse the files according to some sort of parsing rules.

I have searched quite a bit on the internet but found almost nothing on this topic.

What I have found are just things which deal with compiler-generators (Jay, Cojen, etc.) but I don't think that I can use them to generate something for parsing binary files. But I could be wrong on that assumption.

Are there any frameworks which deal especially with easy parsing of binary files or can anyone give me a hint how I could use parser/compiler-generators to do so?

Update: I'm looking for something where I can write a config-file like

file:
  header: FIXED("MAGIC")
  body: content(10)

content:
  value1: BYTE
  value2: LONG
  value3: STRING(10)

and it generates automatically something which parses files which start with "MAGIC", followed by ten times the content-package (which itself consists of a byte, a long and a 10-byte string).

Update2: I found something comparable what I'm looking for, "Construct", but sadly this is a Python-Framework. Maybe this helps someone to get an idea, what I'm looking for.

解决方案

give a try to preon

这篇关于有没有用于二进制文件解析的Java框架?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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