List of usage examples for org.eclipse.jgit.util RawParseUtils decode
private static String decode(ByteBuffer b, Charset charset) throws CharacterCodingException
From source file:com.google.gerrit.httpd.plugins.HttpPluginServlet.java
License:Apache License
private void sendMarkdownAsHtml(PluginContentScanner scanner, PluginEntry entry, String pluginName, PluginResourceKey key, HttpServletResponse res) throws IOException { byte[] rawmd = readWholeEntry(scanner, entry); String encoding = null;/*from ww w . jav a2s. c o m*/ Map<Object, String> atts = entry.getAttrs(); if (atts != null) { encoding = Strings.emptyToNull(atts.get(ATTR_CHARACTER_ENCODING)); } String txtmd = RawParseUtils.decode(Charset.forName(encoding != null ? encoding : "UTF-8"), rawmd); long time = entry.getTime(); if (0 < time) { res.setDateHeader("Last-Modified", time); } sendMarkdownAsHtml(txtmd, pluginName, key, res, time); }
From source file:com.google.gerrit.server.documentation.MarkdownFormatter.java
License:Apache License
public String extractTitleFromMarkdown(byte[] data, String charEnc) { String md = RawParseUtils.decode(Charset.forName(charEnc), data); return findTitle(parseMarkdown(md)); }
From source file:com.madgag.agit.filepath.FilePath.java
License:Open Source License
public synchronized String getPath() { if (path == null) { path = RawParseUtils.decode(Constants.CHARSET, rawPath); rawPath = null; // release memory }/*from ww w . j ava 2 s. c o m*/ return path; }