Example usage for java.lang Character toString

List of usage examples for java.lang Character toString

Introduction

In this page you can find the example usage for java.lang Character toString.

Prototype

public static String toString(int codePoint) 

Source Link

Document

Returns a String object representing the specified character (Unicode code point).

Usage

From source file:com.mirth.connect.donkey.server.data.jdbc.JdbcDao.java

@Override
public void insertConnectorMessage(ConnectorMessage connectorMessage, boolean storeMaps, boolean updateStats) {
    logger.debug(connectorMessage.getChannelId() + "/" + connectorMessage.getMessageId() + "/"
            + connectorMessage.getMetaDataId() + ": inserting connector message with" + (storeMaps ? "" : "out")
            + " maps");

    try {// www.  j a  v  a  2 s.  co  m
        PreparedStatement statement = prepareStatement("insertConnectorMessage",
                connectorMessage.getChannelId());
        statement.setInt(1, connectorMessage.getMetaDataId());
        statement.setLong(2, connectorMessage.getMessageId());
        statement.setString(3, connectorMessage.getServerId());
        statement.setTimestamp(4, new Timestamp(connectorMessage.getReceivedDate().getTimeInMillis()));
        statement.setString(5, Character.toString(connectorMessage.getStatus().getStatusCode()));

        if (connectorMessage.getConnectorName() == null) {
            statement.setNull(6, Types.VARCHAR);
        } else {
            statement.setString(6, connectorMessage.getConnectorName());
        }

        statement.setInt(7, connectorMessage.getSendAttempts());

        if (connectorMessage.getSendDate() == null) {
            statement.setNull(8, Types.TIMESTAMP);
        } else {
            statement.setTimestamp(8, new Timestamp(connectorMessage.getSendDate().getTimeInMillis()));
        }

        if (connectorMessage.getResponseDate() == null) {
            statement.setNull(9, Types.TIMESTAMP);
        } else {
            statement.setTimestamp(9, new Timestamp(connectorMessage.getResponseDate().getTimeInMillis()));
        }

        statement.setInt(10, connectorMessage.getErrorCode());
        statement.setInt(11, connectorMessage.getChainId());
        statement.setInt(12, connectorMessage.getOrderId());
        statement.executeUpdate();

        if (storeMaps) {
            updateSourceMap(connectorMessage);
            updateMaps(connectorMessage);
        }

        updateErrors(connectorMessage);

        if (updateStats) {
            transactionStats.update(connectorMessage.getChannelId(), connectorMessage.getMetaDataId(),
                    connectorMessage.getStatus(), null);
        }
    } catch (SQLException e) {
        throw new DonkeyDaoException(e);
    }
}

From source file:com.aurel.track.exchange.msProject.exchange.MsProjectExchangeBL.java

/**
 * Get the time span fields into a map//from   w w w.  j a  v  a 2s.  c o  m
 *
 * @param str
 * @return
 */
private static Map<String, Double> getTimeSpanFields(String str) {
    Map<String, Double> timeUnitsMap = new HashMap<String, Double>();
    if (str == null || str.charAt(0) != MSPROJECT_TIME_UNITS.START_CHAR) {
        return timeUnitsMap;
    }
    StringBuilder stringBuffer = new StringBuilder(str.substring(1));
    StringBuilder gatherUnitValue = new StringBuilder();
    boolean isMinute = false;
    for (int i = 0; i < stringBuffer.length(); i++) {
        char c = stringBuffer.charAt(i);
        if (Character.isDigit(c)) {
            gatherUnitValue.append(c);
        } else {
            if (c == MSPROJECT_TIME_UNITS.TIME_SEPARATOR) {
                isMinute = true;
                continue;
            }
            if (c == MSPROJECT_TIME_UNITS.MINUTE_OR_MONTH) {
                if (isMinute) {
                    timeUnitsMap.put(MSPROJECT_TIME_UNITS.MINUTE, Double.valueOf(gatherUnitValue.toString()));
                } else {
                    timeUnitsMap.put(MSPROJECT_TIME_UNITS.MONTH, Double.valueOf(gatherUnitValue.toString()));
                }
            } else {
                timeUnitsMap.put(Character.toString(c), Double.valueOf(gatherUnitValue.toString()));
            }
            gatherUnitValue = new StringBuilder();
        }
    }
    return timeUnitsMap;
}

From source file:org.apache.xmlgraphics.fonts.Glyphs.java

/**
 * Return the glyphname from a character,
 * eg, charToGlyphName('\\') returns "backslash"
 *
 * @param ch glyph to evaluate//ww w . j a v  a  2s  .com
 * @return the name of the glyph
 */
public static final String charToGlyphName(char ch) {
    return stringToGlyph(Character.toString(ch));
}

From source file:org.ednovo.gooru.controllers.api.ResourceRestController.java

@AuthorizeOperations(operations = { GooruOperationConstants.OPERATION_RESOURCE_UPDATE })
@Transactional(readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
@RequestMapping(method = RequestMethod.POST, value = "/resource/{gooruContentId}/thumbnail")
public ModelAndView updateResourceThumbnail(HttpServletRequest request,
        @PathVariable(GOORU_CONTENT_ID) String gooruContentId,
        @RequestParam(value = UPLOAD_FILENAME) String fileName,
        @RequestParam(value = SESSIONTOKEN, required = false) String sessionToken, HttpServletResponse response)
        throws Exception {
    request.setAttribute(PREDICATE, RES_UPDATE_THUMBNAIL);
    Map<String, Object> formField = RequestUtil.getMultipartItems(request);

    boolean isHasSlash = StringUtils.contains(fileName, '\\');

    if (isHasSlash) {
        fileName = StringUtils.substringAfterLast(fileName, Character.toString('\\'));
    }/* w  ww. j  a  v a2s.  com*/

    Resource resource = resourceService.updateResourceThumbnail(gooruContentId, fileName, formField);

    ModelAndView jsonmodel = new ModelAndView(REST_MODEL);
    jsonmodel.addObject(MODEL, resource.getFolder() + "/" + fileName);
    return jsonmodel;
}

From source file:com.aliyun.odps.ship.upload.BlockRecordReaderTest.java

/**
 * bom?//from   w ww .  j  av  a2s .  com
 * */
@Test
public void testRDConflictWithBom() throws Exception {

    // file content
    // bom head is consumed by bom detected, only 1 line in block
    {
        BlockInfo blockInfo = new BlockInfo(1L,
                new File("src/test/resources/file/reader/more_char_split_chinese_bom.txt"), 0L, 54L);
        BlockRecordReader reader = new BlockRecordReader(blockInfo, ",,,,", Character.toString((char) 0xFF),
                false);

        byte[][] firstLine = reader.readTextRecord();
        assertEquals("not equal", "123||abc,,,234||bbb,,,333||ccc,,,",
                new String(firstLine[0], "utf8"));

        byte[][] tLine = reader.readTextRecord();
        assertNull("not null", tLine);
    }
    // ignore first line, no record read in this case
    {
        BlockInfo blockInfo = new BlockInfo(1L,
                new File("src/test/resources/file/reader/more_char_split_chinese_bom.txt"), 0L, 54L);
        BlockRecordReader reader = new BlockRecordReader(blockInfo, "||", Character.toString((char) 0xFF),
                true);

        byte[][] firstLine = reader.readTextRecord();
        assertNull("not null", firstLine);
    }
}

From source file:com.gargoylesoftware.htmlunit.html.HtmlPage.java

/**
 * Returns all the HTML elements that are assigned to the specified access key. An
 * access key (aka mnemonic key) is used for keyboard navigation of the
 * page.<p>//from www.j a  v a 2 s .  c  om
 *
 * The HTML specification seems to indicate that one accesskey cannot be used
 * for multiple elements however Internet Explorer does seem to support this.
 * It's worth noting that Mozilla does not support multiple elements with one
 * access key so you are making your HTML browser specific if you rely on this
 * feature.<p>
 *
 * Only the following HTML elements may have <tt>accesskey</tt>s defined: A, AREA,
 * BUTTON, INPUT, LABEL, LEGEND, and TEXTAREA.
 *
 * @param accessKey the key to look for
 * @return the elements that are assigned to the specified accesskey
 */
public List<HtmlElement> getHtmlElementsByAccessKey(final char accessKey) {
    final List<HtmlElement> elements = new ArrayList<>();

    final String searchString = Character.toString(accessKey).toLowerCase(Locale.ROOT);
    for (final HtmlElement element : getHtmlElementDescendants()) {
        if (ACCEPTABLE_TAG_NAMES.contains(element.getTagName())) {
            final String accessKeyAttribute = element.getAttribute("accesskey");
            if (searchString.equalsIgnoreCase(accessKeyAttribute)) {
                elements.add(element);
            }
        }
    }

    return elements;
}

From source file:edu.emory.cci.aiw.i2b2etl.ksb.I2b2KnowledgeSourceBackend.java

public String getGenderPropertyValueSetDelimiter() {
    return Character.toString(genderPropertyValueSetDelimiter);
}

From source file:com.nzion.util.UtilMisc.java

public static String randomAlphaNumericGenerator(int range) {
    String randString = "";
    if (range <= 0) {
        return randString;
    }/*  www .j  a  v  a2 s  . c  o  m*/
    StringBuffer sb = new StringBuffer();
    String block = "abcdefghijklmnopqrstuvwxyz1234567890ABCDEFIJKLMNOPQRSTUVWXYZ";
    sb.append(block).append(block.toUpperCase()).append("0123456789");
    block = sb.toString();
    sb = new StringBuffer();
    Random random = new Random();
    try {
        for (int i = 0; i < range; i++) {
            sb.append(Character.toString(block.charAt(random.nextInt(block.length() - 1))));
        }
        randString = sb.toString();
    } catch (ArrayIndexOutOfBoundsException e) {

    } catch (NumberFormatException e) {

    } catch (Exception e) {
    }
    return randString;
}

From source file:org.exoplatform.wcm.webui.seo.UISEOForm.java

public String CapitalFirstLetters(String str) {
    str = Character.toString(str.charAt(0)).toUpperCase() + str.substring(1);
    return str;
}

From source file:com.lt.adamlee.aagame.GameView.java

public void help(Canvas c) {
    String x = "";
    float textsize = F.hf(19.0f);
    Paint p4 = new Paint();
    Paint p5 = new Paint();
    Paint p6 = new Paint();
    String text = ctx.getString(R.string.helptext);
    p4.setColor(getResources().getColor(R.color.bright_foreground_inverse_material_light));
    p4.setFlags(1);/*from w ww.j  av  a  2 s.  c om*/
    p5.setTypeface(tf);
    p5.setTextSize(F.hf(30.0f));
    p6.setTextSize(textsize);
    p5.setColor(ViewCompat.MEASURED_STATE_MASK);
    c.drawRect(0.0f, 0.0f, (float) screenW, (float) screenH, p4);
    c.drawText(ctx.getString(R.string.help),
            ((float) (screenW / 2)) - (p5.measureText(ctx.getString(R.string.help)) / 2.0f),
            (float) (screenH / 8), p5);
    int i = 0;
    int xv1 = 0;
    int yv1 = (int) textsize;
    while (i < ctx.getString(R.string.helptext).length()) {
        if (text.charAt(i) != '$') {
            c.drawText("  " + ctx.getString(R.string.helptext).charAt(i), (float) xv1,
                    ((float) ((screenH / 8) + yv1)) + (4.0f * textsize), p6);
            xv1 = (int) (((float) xv1)
                    + p6.measureText(Character.toString(ctx.getString(R.string.helptext).charAt(i))));
        }
        if (ctx.getString(R.string.helptext).charAt(i) == '$') {
            i++;
            x = " ";
            yv1 = (int) (((float) yv1) + textsize);
            xv1 = 0;
        }
        i++;
    }
}