• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ParseException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jbibtex.ParseException的典型用法代码示例。如果您正苦于以下问题:Java ParseException类的具体用法?Java ParseException怎么用?Java ParseException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ParseException类属于org.jbibtex包,在下文中一共展示了ParseException类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: downloadAllPapers

import org.jbibtex.ParseException; //导入依赖的package包/类
/**
 *
 * @throws IOException 
 * @throws ParseException 
 * @throws InvalidPaperIdException
 */
public void downloadAllPapers() throws IOException, ParseException, InvalidPaperIdException {
    System.out.printf(
            "\nDownloading %d papers from %s respository to %s\n", 
            getEntriesCollection().size(), repository, downloadDir);
    System.out.printf("Origin BibTeX file: %s\n\n", bibFileName);
    int i = 0;
    for (BibTeXEntry bibEntry : getEntriesCollection()) {
        i++;
        Paper paper = repository.getPaperInstance(this, bibEntry);
        paper.setOrderInsideBibTexFile(i);
        try {
            System.out.println(paper);
            paper.downloadAndIfSuccessfulSetLocalFileNameAndUrl();
        } catch (PaperNotAvailableForDownloadException ex) {
            System.out.println("Paper " + paper.getTitle() + ". " + ex.getLocalizedMessage());
        }
    }
    this.saveChangesInBibTexFile();
}
 
开发者ID:manoelcampos,项目名称:BibTeXPaperDownloader,代码行数:26,代码来源:BibTexPapersDownloader.java


示例2: main

import org.jbibtex.ParseException; //导入依赖的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


示例3: loadDatabase

import org.jbibtex.ParseException; //导入依赖的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


示例4: keyValueToStr

import org.jbibtex.ParseException; //导入依赖的package包/类
/**
 * 
 * Converts to String a value get from a BibTeX entry.
 *
 * @param value Value of a field from a BibTeX entry.
 * @return Returns the value as string
 * @throws org.jbibtex.ParseException
 * @throws java.io.UnsupportedEncodingException
 */
public String keyValueToStr(Value value) throws ParseException, UnsupportedEncodingException {
    String str = (value == null ? "" : value.toUserString());
    if (str.indexOf('\\') > -1 || str.indexOf('{') > -1) {
        LaTeXParser latexParser = new LaTeXParser();
        List<LaTeXObject> latexObjects = latexParser.parse(str);
        LaTeXPrinter latexPrinter = new LaTeXPrinter();
        str = latexPrinter.print(latexObjects);
    }
    return str;
}
 
开发者ID:manoelcampos,项目名称:BibTeXPaperDownloader,代码行数:20,代码来源:Paper.java


示例5: main

import org.jbibtex.ParseException; //导入依赖的package包/类
/**
 * Executes the command line application to parse the bibtex file
 * and download the papers.
 * 
 * @param args The command line arguments, in order:<br/>
 *   1º - Name of the bibtex file to be processed.<br/>
 *   2º - Destination directory where to download the papers.<br/>
 *   3º - Name of the repository where to download the papers.
 * @see Main#showUsage() 
 */
public static void main(String args[]) {
    try {
        new Main(args);
    }catch(IllegalArgumentException e){
        showUsage();
    } catch (ParseException|InvalidPaperIdException|IOException|ClassNotFoundException|InstantiationException ex) {
        System.err.println(ex.getMessage());
        Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
    }    
}
 
开发者ID:manoelcampos,项目名称:BibTeXPaperDownloader,代码行数:21,代码来源:Main.java


示例6: createBibTexParserAndParseIt

import org.jbibtex.ParseException; //导入依赖的package包/类
private void createBibTexParserAndParseIt(final String bibFileName) throws ParseException {
    try (final CharacterFilterReader filterReader = new CharacterFilterReader(reader)) {
        parser = this.getBibTexParserInstance();
        database = parser.parse(filterReader);
    } catch (Exception e) {
        e.printStackTrace(System.out);
        throw new ParseException(
                "It was not possible to pase the bibtex file " + bibFileName + ". Maybe the file is invalid\n");        
    }
}
 
开发者ID:manoelcampos,项目名称:BibTeXPaperDownloader,代码行数:11,代码来源:BibTexPapersDownloader.java


示例7: parseLaTeX

import org.jbibtex.ParseException; //导入依赖的package包/类
private String parseLaTeX(String latexString) {
	String plainString = "";
	try {
		LaTeXParser parser = new LaTeXParser();
		List<LaTeXObject> latexObjects = parser.parse(latexString);
		LaTeXPrinter printer = new LaTeXPrinter();
		plainString = printer.print(latexObjects);
	} catch (TokenMgrException | ParseException e) {
		System.out.println(e.getMessage());
		return latexString;
	}
	return plainString;
}
 
开发者ID:sebastiangoetz,项目名称:slr-toolkit,代码行数:14,代码来源:BibtexResourceImpl.java


示例8: BibTeXConverter

import org.jbibtex.ParseException; //导入依赖的package包/类
/**
 * Default constructor
 */
public BibTeXConverter() {
	try {
		latexParser = new LaTeXParser();
	} catch (ParseException e) {
		// can actually never happen because the default constructor
		// of LaTeXParser doesn't throw
		throw new RuntimeException(e);
	}
	latexPrinter = new LaTeXPrinter();
}
 
开发者ID:michel-kraemer,项目名称:citeproc-java,代码行数:14,代码来源:BibTeXConverter.java


示例9: loadUnixDatabase

import org.jbibtex.ParseException; //导入依赖的package包/类
/**
 * Loads the <code>unix.bib</code> database from the classpath
 * @return the database
 * @throws IOException if the database could not be loaded
 * @throws ParseException if the database is invalid
 */
protected static BibTeXDatabase loadUnixDatabase() throws IOException, ParseException {
	BibTeXDatabase db;
	try (InputStream is = AbstractBibTeXTest.class.getResourceAsStream("/unix.bib.gz")) {
		GZIPInputStream gis = new GZIPInputStream(is);
		db = new BibTeXConverter().loadDatabase(gis);
	}
	return db;
}
 
开发者ID:michel-kraemer,项目名称:citeproc-java,代码行数:15,代码来源:AbstractBibTeXTest.java


示例10: Main

import org.jbibtex.ParseException; //导入依赖的package包/类
public Main(String args[]) throws ParseException, ClassNotFoundException, InstantiationException, IOException, FileNotFoundException, InvalidPaperIdException {
     getComandLineParameters(args);
     downloadPapersInBibFile();   
}
 
开发者ID:manoelcampos,项目名称:BibTeXPaperDownloader,代码行数:5,代码来源:Main.java


示例11: downloadPapersInBibFile

import org.jbibtex.ParseException; //导入依赖的package包/类
private void downloadPapersInBibFile() throws FileNotFoundException, ParseException, ClassNotFoundException, InstantiationException, IOException, InvalidPaperIdException {
    BibTexPapersDownloader bibtex = new BibTexPapersDownloader(bibFileName, repositoryName);
    bibtex.setDownloadDir(downloadDir);
    bibtex.downloadAllPapers();
}
 
开发者ID:manoelcampos,项目名称:BibTeXPaperDownloader,代码行数:6,代码来源:Main.java


示例12: BibTexPapersDownloader

import org.jbibtex.ParseException; //导入依赖的package包/类
/**
 * 
 * @param bibFileNameContainingThePapersToDownload Name of BibTeX file to be parsed.
 * @param classNameOfRepositoryWhereToDownloadThePapers Name of the class of the web repository
 * where the papers in the bibtex file have to be downloaded.
 * For instance, IEEE, ACM, Elsevier, etc.
 * @throws java.io.FileNotFoundException
 * @throws org.jbibtex.ParseException
 * @throws java.lang.ClassNotFoundException
 * @throws java.lang.InstantiationException
 * @see com.manoelcampos.bibtexpaperdownloader.repository.PaperRepositoryFactory
 */
public BibTexPapersDownloader(
        final String bibFileNameContainingThePapersToDownload, 
        final String classNameOfRepositoryWhereToDownloadThePapers) throws FileNotFoundException, ParseException, ClassNotFoundException, InstantiationException {
    this.repository = 
            PaperRepositoryFactory.getInstance(
                    classNameOfRepositoryWhereToDownloadThePapers);
    this.setBibFileNameAndCreateBibFileReader(bibFileNameContainingThePapersToDownload);        
    this.createBibTexParserAndParseIt(bibFileNameContainingThePapersToDownload);
}
 
开发者ID:manoelcampos,项目名称:BibTeXPaperDownloader,代码行数:22,代码来源:BibTexPapersDownloader.java


示例13: loadLibrary

import org.jbibtex.ParseException; //导入依赖的package包/类
Library loadLibrary(InputStream is) throws IOException, ParseException {
	Reader reader = new InputStreamReader(is, "UTF-8");
	$name parser = new $name();
	return parser.parse(reader);
}
 
开发者ID:michel-kraemer,项目名称:citeproc-java,代码行数:6,代码来源:Converter.java



注:本文中的org.jbibtex.ParseException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TextBuilder类代码示例发布时间:2022-05-23
下一篇:
Java SnackbarOnDeniedPermissionListener类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap