List of usage examples for java.lang Character toChars
public static char[] toChars(int codePoint)
From source file:com.blackducksoftware.integration.hub.ScannerSplitStream.java
@Override public void write(final int codePoint) throws IOException { outputFileStream.write(codePoint);/*from ww w .j av a 2 s .c o m*/ if (EOF == codePoint) { throw new EOFException(); } boolean atLineEnd = false; if (ETX == codePoint || EOT == codePoint) { atLineEnd = true; } else if (LF == codePoint && CR != previousCodePoint) { atLineEnd = true; } else if (LF == codePoint && CR == previousCodePoint) { atLineEnd = true; // also need to remove the previously consumed CR currentLine = currentLine.substring(0, currentLine.length() - 1); } else if (LF != codePoint && CR == previousCodePoint) { processLine(currentLine); currentLine = ""; } previousCodePoint = codePoint; if (atLineEnd) { processLine(currentLine); currentLine = ""; } else { final String stringAscii = new String(Character.toChars(codePoint)); currentLine += stringAscii; } }
From source file:nlp.wikipedia.parser.SwebleTextAstWalker.java
public void visit(WtXmlCharRef cr) { if (!isInsideFilteredSection()) { sb.append(Character.toChars(cr.getCodePoint())); } }
From source file:com.datastax.loader.parser.AbstractParser.java
public String extractUntil(IndexedLine il, Character delim, Character escape, Character quote, boolean inquote) throws IOException, ParseException { if (null == delim) { return null; }/*w w w. j a v a 2 s. com*/ StringBuilder sb = new StringBuilder(10240); char c; while (il.hasNext()) { c = il.getNext(); if ((c == delim) && (!inquote)) { break; } sb.append(c); if (null != quote) { if (c == quote) { inquote = !inquote; } } if (null != escape) { if (c == escape) { c = il.getNext(); sb.append(Character.toChars(c)); } } } return sb.toString(); }
From source file:de.vandermeer.asciilist.commons.AlphaLiteralUtils.java
/** * Returns an alphanumeric literal representation of the given number using UTF Fullwidth Latin Capital Letter (upper case) characters. * @param number to convert//from ww w . j a v a2 s . co m * @return alphanumeric literal representation * @throws NotImplementedException if the number is out of bounds (currently smaller than 1 and larger than 26) */ public final static String toFullwidthLatinCapital(int number) { if (number < 1 || number > 26) { throw new NotImplementedException( "Alphanumeric literals supported 0<number<27 - number was: " + number); } return new String(Character.toChars(number + 65312)); }
From source file:de.vandermeer.asciilist.commons.ArabicLiteralUtils.java
/** * Returns an alphanumeric literal representation of the given number using UTF Dingbat Sanserif Circled Digit characters. * @param number to convert//from w w w.j a va 2 s . c o m * @return alphanumeric literal representation * @throws NotImplementedException if the number is out of bounds (currently smaller than 1 and larger than 10) */ public final static String toDingbatSanserifCircledDigit(int number) { if (number < 1 || number > 10) { throw new NotImplementedException( "Arabic literals - UTF Dingbat Sanserif Circled Digit - supported 0<number<11 - number was: " + number); } return new String(Character.toChars(number + 10111)); }
From source file:org.bibsonomy.util.tex.TexDecode.java
/** * parse the file containing the mappings of unicode characters to latex * macros and store it in texMap./*ww w . j a va 2 s . c om*/ */ private static final void loadMapFile() { Scanner scanner = new Scanner( TexDecode.class.getClassLoader().getResourceAsStream(LATEXMACRO_UNICODECHAR_MAP_FILENAME), "UTF-8"); String line; String[] parts; while (scanner.hasNextLine()) { line = scanner.nextLine(); parts = line.split(LATEXMACRO_UNICODECHAR_MAP_DELIM); // convert hex representation into unicode string texMap.put(parts[1].trim(), String.valueOf(Character.toChars(Integer.parseInt(parts[0].trim(), 16)))); LOGGER.debug("added new mapping " + parts[1].trim() + " -> " + texMap.get(parts[1].trim())); } }
From source file:org.eclipse.rdf4j.rio.nquads.NQuadsParser.java
private int parseQuad(int c) throws IOException, RDFParseException, RDFHandlerException { boolean ignoredAnError = false; try {/*from w ww . j ava2 s . c o m*/ c = parseSubject(c); c = skipWhitespace(c); c = parsePredicate(c); c = skipWhitespace(c); c = parseObject(c); c = skipWhitespace(c); // Context is not required if (c != '.') { c = parseContext(c); c = skipWhitespace(c); } if (c == -1) { throwEOFException(); } else if (c != '.') { reportFatalError("Expected '.', found: " + new String(Character.toChars(c))); } c = assertLineTerminates(c); } catch (RDFParseException rdfpe) { if (getParserConfig().isNonFatalError(NTriplesParserSettings.FAIL_ON_NTRIPLES_INVALID_LINES)) { reportError(rdfpe, NTriplesParserSettings.FAIL_ON_NTRIPLES_INVALID_LINES); ignoredAnError = true; } else { throw rdfpe; } } c = skipLine(c); if (!ignoredAnError) { Statement st = createStatement(subject, predicate, object, context); if (rdfHandler != null) { rdfHandler.handleStatement(st); } } subject = null; predicate = null; object = null; context = null; return c; }
From source file:org.syncany.plugins.php.PhpTransferManager.java
public String getAnswer(InputStream s) throws Exception { StringBuffer line = new StringBuffer(); int c = s.read(); while (c != -1 && c != '\n') { line.append(Character.toChars(c)); c = s.read();//from www . j a v a2s .c o m } return line.toString(); }
From source file:com.denimgroup.threadfix.framework.impl.rails.RailsControllerParser.java
@Override public void processToken(int type, int lineNumber, String stringValue) { String charValue = null;/*from w w w. j av a 2 s .c o m*/ if (type > 0) charValue = String.valueOf(Character.toChars(type)); if (stringValue != null) { tokenQueue.add(stringValue); } else if (charValue != null) { tokenQueue.add(charValue); } if (tokenQueue.size() > 10) tokenQueue.remove(); switch (currentCtrlState) { case CLASS: processClass(type, stringValue, charValue); break; case METHOD: processMethod(type, stringValue, charValue); break; case PARAMS: processParams(type, stringValue, charValue); break; } if (stringValue != null) { String s = stringValue.toLowerCase(); if (s.equals("private")) { _continue = false; } else if (s.equals("class")) { currentCtrlState = ControllerState.CLASS; if (currentRailsController == null) currentRailsController = new RailsController(); } else if (s.equals("def")) { currentCtrlState = ControllerState.METHOD; if (currentCtrlMethod == null) currentCtrlMethod = new RailsControllerMethod(); else { currentRailsController.addControllerMethod(currentCtrlMethod); currentCtrlMethod = new RailsControllerMethod(); } } else if (s.equals("params")) { currentCtrlState = ControllerState.PARAMS; } } }
From source file:de.vandermeer.asciilist.commons.AlphaLiteralUtils.java
/** * Returns an alphanumeric literal representation of the given number using UTF Fullwidth Latin Small Letter (lower case) characters. * @param number to convert//from w w w . j av a 2 s . c om * @return alphanumeric literal representation * @throws NotImplementedException if the number is out of bounds (currently smaller than 1 and larger than 26) */ public final static String toFullwidthLatinSmall(int number) { if (number < 1 || number > 26) { throw new NotImplementedException( "Alphanumeric literals supported 0<number<27 - number was: " + number); } return new String(Character.toChars(number + 65344)); }