本文整理汇总了Java中org.jbibtex.BibTeXParser类的典型用法代码示例。如果您正苦于以下问题:Java BibTeXParser类的具体用法?Java BibTeXParser怎么用?Java BibTeXParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BibTeXParser类属于org.jbibtex包,在下文中一共展示了BibTeXParser类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: main
import org.jbibtex.BibTeXParser; //导入依赖的package包/类
/**
* Helper tool to convert bibtex to {@link Reference} annotations. Reads
* from stdin, writes to stdout.
*
* @param args
* not used
* @throws IOException
* @throws ParseException
*/
public static void main(String[] args) throws IOException, ParseException {
System.out.println("Enter bibtex record(s), followed by ctrl-d: ");
final Reader reader = new InputStreamReader(System.in);
final BibTeXParser parser = new BibTeXParser();
final BibTeXDatabase database = parser.parse(reader);
System.out.println();
for (final BibTeXEntry entry : database.getEntries().values()) {
final Reference r = MockReference.makeReference(entry);
System.out.println(StandardFormatters.REFERENCE_ANNOTATION.format(r));
}
}
开发者ID:openimaj,项目名称:openimaj,代码行数:25,代码来源:BibtexToReference.java
示例2: loadDatabase
import org.jbibtex.BibTeXParser; //导入依赖的package包/类
/**
* <p>Loads a BibTeX database from a stream.</p>
* <p>This method does not close the given stream. The caller is
* responsible for closing it.</p>
* @param is the input stream to read from
* @return the BibTeX database
* @throws IOException if the database could not be read
* @throws ParseException if the database is invalid
*/
public BibTeXDatabase loadDatabase(InputStream is) throws IOException, ParseException {
Reader reader = new InputStreamReader(is, "UTF-8");
BibTeXParser parser = new BibTeXParser() {
@Override
public void checkStringResolution(Key key, BibTeXString string) {
if (string == null) {
//ignore
}
}
};
try {
return parser.parse(reader);
} catch (TokenMgrException err) {
throw new ParseException("Could not parse BibTeX library: " +
err.getMessage());
}
}
开发者ID:michel-kraemer,项目名称:citeproc-java,代码行数:27,代码来源:BibTeXConverter.java
注:本文中的org.jbibtex.BibTeXParser类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论