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:org.alfresco.repo.rendition.script.ScriptRenditionService.java

/**
 * This method takes a string representing a QName and converts it to a QName
 * object./*from  w w  w  . j  ava  2s.  c om*/
 * @param qnameString the string can be either a short or long form qname.
 * @return a QName object
 */
private QName createQName(String qnameString) {
    QName result;
    if (qnameString.startsWith(Character.toString(QName.NAMESPACE_BEGIN))) {
        // It's a long-form qname string
        result = QName.createQName(qnameString);
    } else {
        // It's a short-form qname string
        result = QName.createQName(qnameString, serviceRegistry.getNamespaceService());
    }
    return result;
}

From source file:com.sck.maininterface.PaymentInfo.java

public String read(String file) {
    try {//from   w ww .j  a va  2 s.c  o  m
        FileInputStream fin = openFileInput(file);
        int c;
        String temp = "";

        while ((c = fin.read()) != -1) {
            temp = temp + Character.toString((char) c);
        }
        // et.setText(temp);

        return temp;
    } catch (Exception e) {
        Log.e("Read Error", e.toString());
    }

    return "";

}

From source file:com.mplayer_remote.ServicePlayAFile.java

private String escapeEveryCharacterInGivenString(String stringToEscape) {
    String escapedString = "";
    for (int i = 0; i < stringToEscape.length(); i++) {
        escapedString = escapedString + "\\" + Character.toString(stringToEscape.charAt(i));
    }//  w  ww. j a va2s .co m

    return escapedString;
}

From source file:com.evolveum.midpoint.repo.sql.query.definition.ClassDefinitionParser.java

private String getPropertyName(String methodName) {
    int startIndex = 3; //method name starts with "get"
    if (methodName.startsWith("is")) {
        startIndex = 2;/*from w  w  w  .j  a v a  2  s .  co  m*/
    }

    char first = Character.toLowerCase(methodName.charAt(startIndex));
    return Character.toString(first) + StringUtils.substring(methodName, startIndex + 1, methodName.length());
}

From source file:dcheungaa.procal.MainActivity.java

@Override
public void onWindowFocusChanged(boolean hasFocus) {
    TextView cursor = (TextView) MainActivity.views.get("cursor");
    TextView matrixDisplay = (TextView) MainActivity.views.get("matrixDisplay");
    super.onWindowFocusChanged(hasFocus);
    if (call_load) {
        call_load = false;/*  ww  w  .j  av  a 2 s  .  c  o m*/
        fontWidth = cursor.getWidth();
        fontHeight = cursor.getHeight();
        cursor.setText(Character.toString((char) 0x258E));
        //cursor.setTop(matrixDisplay.getTop());
        cursor.setPadding(matrixDisplay.getPaddingLeft(), cursor.getPaddingTop(), cursor.getPaddingRight(),
                cursor.getPaddingBottom());
        cursor.setLeft(matrixDisplay.getLeft());
        //CursorHandler.hideCursor();
        RelativeLayout cm = (RelativeLayout) findViewById(R.id.content_main);
        LinearLayout rows = (LinearLayout) findViewById(R.id.llKeyPad);
        keyPad.KeyPad_resize(cm, rows);
        int fnBtnHeight = keyPad.btn_rows.get(0).get(0).get_mheight();
        System.out.print(Integer.toString(fnBtnHeight));
        varPad.resize(fnBtnHeight, fnBtnHeight * 3, svVar);
        cmdPad.resize(fnBtnHeight, fnBtnHeight * 3, svCmd);
        constPad.resize(fnBtnHeight, fnBtnHeight * 3, svConst);
    }
}

From source file:com.almarsoft.GroundhogReader.lib.MessageTextProcessor.java

private static String escapeInitialSpaces(String line) {

    StringBuilder newline = new StringBuilder(line.length());
    char c;/*  w w  w . j  a  va2  s  . co  m*/
    boolean atStart = true;
    String append = null;

    for (int i = 0; i < line.length(); i++) {
        c = line.charAt(i);
        append = null;

        if (atStart) {
            if (c == ' ')
                append = "&nbsp;";
            else
                atStart = false;
        }
        if (append == null)
            append = Character.toString(c);

        newline.append(append);
    }
    return newline.toString();
}

From source file:com.ettrema.zsync.Upload.java

/**
 * A helper method that reads from an InputStream and copies to an OutputStream until the LF character is read (The LF is not
 * copied to the OutputStream). An exception is thrown if maxsearch bytes are read without encountering LF. This is used by {@link #parse} 
 * to copy the relocate values into a BufferingOutputStream. 
 * //from  w  w w .  ja  v a  2  s .  c  o  m
 * @param in The InputStream to read from
 * @param maxsearch The maximum number of bytes to search for a newline
 * @param out The OutputStream to copy into
 * @return The number of bytes read from in
 * @throws IOException
 * @throws ParseException If a newline is not found within maxsearch reads
 */
private static int copyLine(InputStream in, int maxsearch, OutputStream out)
        throws IOException, ParseException {

    if (maxsearch <= 0) {
        throw new RuntimeException("copyLine: Invalid maxsearch " + maxsearch);
    }

    byte nextByte, bytesRead = 0;
    byte NEWLINE = Character.toString(LF).getBytes(CHARSET)[0];

    while ((nextByte = (byte) in.read()) > -1) {

        if (++bytesRead > maxsearch) {
            throw new ParseException("Could not find delimiter within " + maxsearch + " bytes.", 0);
        }
        if (nextByte == NEWLINE) {
            break;
        }
        out.write(nextByte);
    }

    return bytesRead;
}

From source file:de.micromata.genome.gwiki.page.impl.wiki.parser.GWikiWikiParser.java

protected void parseDecoratedWord(GWikiWikiTokens tks, GWikiWikiParserContext ctx) {
    char decChar = tks.curToken();
    char pk = tks.peekToken(-1);
    if (isDecorateStart(tks) == false) {
        ctx.addTextFragement(tks.curTokenString());
        if (tks.hasNext() == true) {
            tks.nextToken();/*from w  w w . jav  a  2s .co m*/
            parseWord(tks, ctx);
        } else {
            tks.nextToken();
        }
        return;
    }
    //
    int ltkpos = tks.getTokenPos();
    tks.nextToken();
    char prevDecChar = tks.addStopToken(decChar);
    List<GWikiFragment> nestedList = new ArrayList<GWikiFragment>();
    do {
        ctx.pushFragList();
        parseWords(tks, ctx);
        List<GWikiFragment> nested = ctx.popFragList();
        nestedList.addAll(nested);
        if (prevDecChar == 0) {
            tks.removeStopToken(decChar);
        }

        char ct = tks.curToken();
        if (ct == '\n' || ct == 0) {
            ctx.addTextFragement(Character.toString(decChar));
            tks.setTokenPos(ltkpos + 1);
            return;
        }
        // char ct = tks.nextToken();
        if (ct == decChar && isDecorateEnd(tks) == true) {
            String tag = getWordDecorator(decChar);
            GWikiFragmentTextDeco frag = new GWikiFragmentTextDeco(decChar, "<" + tag + ">", "</" + tag + ">",
                    nestedList);
            ctx.addFragment(frag);
            tks.nextToken();
            return;
        }
        if (tks.hasNext() == false) {
            ctx.addTextFragement(Character.toString(decChar));
            tks.setTokenPos(ltkpos + 1);
            return;
        }
    } while (true);
}

From source file:ch.wir_entwickeln.yavanna.serialport.SerialPortCCI.java

/**
 * Sends data on the serial port.//from   w w w.j ava2  s .  c o  m
 * 
 * @param data The data to send.
 */
public synchronized void send(byte[] data) {
    String formattedData = new String(data).replaceAll(Character.toString((char) 13), "<CR>");
    logger.debug("Sending '{}' on serial port {}...", new String[] { formattedData, portName });
    try {
        // Write data to serial port buffer
        for (byte dataByte : data) {
            outputStream.write(dataByte);
            try {
                Thread.sleep(30);
            } catch (InterruptedException e) {
                // Ignore exception
            }
        }
        outputStream.flush();
    } catch (IOException e) {
        logger.error("Error sending data on serial port {}: {}", portName, e.getMessage());
    }
}

From source file:com.netflix.dyno.jedis.DynoJedisPipeline.java

/**
 * Checks that a pipeline is associated with a single key. If there is a hashtag
 * defined in the first host of the connectionpool then we check that first.
 * /*  w w  w  .java  2 s  .c  om*/
 * @param key
 */
private void checkKey(final String key) {

    /*
     * Get hashtag from the first host of the active pool We cannot use the
     * connection object because as of now we have not selected a connection. A
     * connection is selected based on the key or hashtag respectively.
     */
    String hashtag = connPool.getConfiguration().getHashtag();
    if (hashtag == null || hashtag.isEmpty()) {
        if (theKey.get() != null) {
            verifyKey(key);
        } else {
            boolean success = theKey.compareAndSet(null, key);
            if (!success) {
                // someone already beat us to it. that's fine, just verify
                // that the key is the same
                verifyKey(key);
            } else {
                pipelined(key);
            }
        }
    } else {
        /*
         * We have a identified a hashtag in the Host object. That means Dynomite has a
         * defined hashtag. Producing the hashvalue out of the hashtag and using that as
         * a reference to the pipeline
         */
        String hashValue = StringUtils.substringBetween(key, Character.toString(hashtag.charAt(0)),
                Character.toString(hashtag.charAt(1)));
        checkHashtag(key, hashValue);
    }
}