gpt4 book ai didi

java - 用于解析专有设置文件的库

转载 作者:行者123 更新时间:2023-12-02 08:15:31 25 4
gpt4 key购买 nike

是否有任何免费库可供我用来解析像这样描述的独特设置文件(取自实际文件)。也许像 ini4j (也许 ini4j 的可定制性足以让我可以使用它?)。在我开始努力编写自己的代码之前先检查一下:(

/*** This file specifies settings used by the __. Each
/*** line is delimited by colons. This file contains global as well as
/*** program specific settings. First part is always the variable name.
/*** Second part can be a single or a wildcarded program id, in which
/*** case the setting will be program specific. In the case of global
/*** variables, the second part will be the actual setting. The third
/*** and subsequent parts will only appear for program specific variables
/*** and will be the settings for those variables. Any comments at the
/*** end of the line have to be preceded by a colon, in order to separate
/*** it from the rest of the line.

我的文件正文如下所示(仅作为示例):

DELIMITER=;
FROM_DIR;msc*;/usr/foo/bar
FROM_DIR;msd*;/usr/foo/bar
LOG_DIR;ms*;/usr/foo/logs
DUMP_FLAG;N
MAX_JOBS;8

最佳答案

此属性文件格式看起来足够自定义,您使用的任何解析库都会增加其值得的复杂性。我的建议是,您需要的唯一外部库是 JUnit :) 但是,如果您确实想做学习练习,请查看 http://www.antlr.org/

关于java - 用于解析专有设置文件的库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6529934/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com