Example usage for java.lang String toString

List of usage examples for java.lang String toString

Introduction

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

Prototype

public String toString() 

Source Link

Document

This object (which is already a string!) is itself returned.

Usage

From source file:biz.neustar.pc.ui.manager.impl.PaymentManagerImpl.java

private Map<String, Object> getErrorResponse(ClientResponse clientResponse) {
    try {/*from w ww  .  j a  v  a2  s. c  o m*/
        clientResponse.bufferEntity();
        // copy buffer to a string and put back a copy
        final ClientResponse finalClientResponse = clientResponse;
        String buffer = IOUtils.toString(finalClientResponse.getEntityInputStream(), "UTF-8");
        LOGGER.info(buffer);
        LOGGER.info(buffer.toString());
        return new ObjectMapper().readValue(buffer, Map.class);
    } catch (Exception e) {
        // just eat the exception -- something else went wrong, it'll be
        // found when the content is re-read
        // by higher-level code
        LOGGER.warn("Had a bad request that wasn't related to an auth issue.  ", e);
        return Collections.emptyMap();
    }
}

From source file:cc.kave.episodes.mining.reader.ReposParser.java

public List<Event> learningStream(int numberOfRepos) throws ZipException, IOException {
    EventStreamGenerator generator = new EventStreamGenerator();
    StringBuilder repositories = new StringBuilder();
    String repoName = "";
    int repoID = 0;

    for (String zip : findZips(contextsDir)) {
        Logger.log("Reading zip file %s", zip.toString());
        if ((repoName.equalsIgnoreCase("")) || (!zip.startsWith(repoName))) {
            repoID++;//from   w w w .j  a v  a 2 s .  c  om
            if (repoID > numberOfRepos) {
                break;
            }
            repoName = getRepoName(zip);
            repositories.append(repoName + "\n");
        }
        ReadingArchive ra = contextsDir.getReadingArchive(zip);

        while (ra.hasNext()) {
            Context ctx = ra.getNext(Context.class);
            if (ctx == null) {
                continue;
            }
            generator.add(ctx);
        }
        ra.close();
    }
    FileUtils.writeStringToFile(new File(getReposPath(numberOfRepos)), repositories.toString());
    List<Event> allEvents = generator.getEventStream();
    return allEvents;
}

From source file:com.cosplay.websocket.ChatAnnotation.java

@OnMessage
public void incoming(String message) {
    // Never trust the client
    String filteredMessage = String.format("%s: %s", nickname, HTMLFilter.filter(message.toString()));
    broadcast(filteredMessage);//from  ww  w .j a v a2  s.  c om
}

From source file:hu.petabyte.redflags.engine.gear.indicator.hu.TechCapGeoCondIndicator.java

@Override
protected IndicatorResult flagImpl(Notice notice) {
    String s = String.format("%s\n%s", //
            fetchTechnicalCapacity(notice), //
            fetchAdditionalInfo(notice) //
    ).trim();/*  w ww.j av  a  2 s.  co m*/

    for (String line : s.toString().split("\n")) {
        line = HuIndicatorHelper.words2Digits(s);
        if (geoCondPattern.matcher(line).find() && !exceptionPattern.matcher(line).find()) {
            return returnFlag();
        }
    }
    return null;
}

From source file:XBMCmote.java

@Command
public String raw(String request) {
    String response = XBMC.sendCommandRaw(request);
    return String.format("%s\n%s", request.toString(), response.toString());
}

From source file:gov.va.vinci.leo.listener.CSVBaseListenerTest.java

@Test
public void testSimple() throws IOException {
    File f = File.createTempFile("testSimple", "txt");
    TestCsvListener listener = new TestCsvListener(f);
    listener.entityProcessComplete(cas, null);
    String b = FileUtils.readFileToString(f).trim();
    assertEquals("\"a\",\"b\",\"\"\"c\"", b.toString());
}

From source file:gov.va.vinci.leo.listener.CSVBaseListenerTest.java

@Test
public void testCharSeprarator() throws IOException {
    File f = File.createTempFile("testCharSeprarator", "txt");
    TestCsvListener listener = new TestCsvListener(f, '-');
    listener.entityProcessComplete(cas, null);
    String b = FileUtils.readFileToString(f).trim();
    assertEquals("\"a\"-\"b\"-\"\"\"c\"", b.toString());
}

From source file:gov.va.vinci.leo.listener.CSVBaseListenerTest.java

@Test
public void testCharSepraratorQuoteChar() throws IOException {
    File f = File.createTempFile("testCharSepraratorQuoteCharEscapeChar", "txt");
    TestCsvListener listener = new TestCsvListener(f, '-', '\'');
    listener.entityProcessComplete(cas, null);
    String b = FileUtils.readFileToString(f).trim();
    assertEquals("\'a\'-\'b\'-\'\"\"c\'", b.toString());
}

From source file:com.phonty.improved.Calls.java

private ArrayList<CallItem> parse(String response) {
    try {/*from www . j  ava  2  s  .  co m*/
        JSONArray jsonArray = new JSONArray(response.toString());
        for (int i = 0; i < jsonArray.length(); ++i) {
            JSONObject rec = jsonArray.getJSONObject(i);
            VALUES.add(new CallItem(rec.getString("name"), rec.getString("amount"), rec.getString("date"),
                    rec.getString("duration")));
        }
        Log.e("RESPONSE", jsonArray.length() + "");
    } catch (Exception e) {
        e.printStackTrace();
    }

    return VALUES;
}

From source file:gov.va.vinci.leo.listener.CSVBaseListenerTest.java

@Test
/**/*  w w w.  j  a  v  a2s  . co m*/
 * Test NOT escaping quotes.
 */
public void testCharSepraratorQuoteCharEscapeChar() throws IOException {
    File f = File.createTempFile("testCharSepraratorQuoteCharEscapeChar", "txt");
    TestCsvListener listener = new TestCsvListener(f, '-', '\'', '~');
    listener.entityProcessComplete(cas, null);
    String b = FileUtils.readFileToString(f).trim();
    assertEquals("\'a\'-\'b\'-\'\"c\'", b.toString());
}