Decodes a string into a {@link JsonStructure}

@param text the string to decode cannot be null
@return a JsonStructure representation of the string
@throws com.baasbox.android.json.JsonException if the text cannot be parsed as json.
542907
public static JsonStructure decode(String text) {
        if (text == null) throw new IllegalArgumentException("text cannot be null");
        StringReader sr = new StringReader(text);
        JsonReader r = new JsonReader(sr);
        return decodeFully(r);
    }
244903
@POST
    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
    @Produces(MediaType.APPLICATION_JSON)
    public static Collection<Utterance> mapText(final String text)
            throws IOException, InterruptedException, JAXBException, SQLException, ParserConfigurationException,
                   SAXException {
        return mapTextWithOptions(new AnalysisRequest(text));
    }
1151290
@Override public boolean send(String text) {
    if (text == null) throw new NullPointerException("text == null");
    return send(ByteString.encodeUtf8(text), OPCODE_TEXT);
  }
1029682
public void setText(String text) {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
      if ((text == null) || text.length() < 257) {
        SibTr.entry(this, tc, "setText", text);
      }
      else {
        SibTr.entry(this, tc, "setText", new Object[]{text.length(), text.substring(0,200)+"..."});
      }
    }

    // If the payload is changing, we need to clear all the cached values.
    softRefToDocument = null;
    clearCachedLengths();

    // Set the payload data
    getPayload().setField(JmsTextBodyAccess.BODY_DATA_VALUE, text);

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setText");
  }
335274
public static <T> T parseObject(String text, Class<T> clazz) {
        Object obj = JSONSerializer.deserialize(text);
        return BeanSerializer.deserializeByType(obj, clazz);
    }
322249
public void statusMessage(String text) throws IOException {
		Map<String, Object> m = JSONProtocol.cmd("message");
		m.put("text", text);
		pipe.send(m);
		if (!JSONProtocol.check(m, pipe.recv())) {
			throw new IOException("Could not display status");
		}
	}
567648
public static final byte[] getBytes(String text, StandardCharset standardCharset) {
        try {
            //Every implementation of the Java platform is required to support the standard charsets
            //So no point in throwing a checked exception
            return text.getBytes(standardCharset.charsetName());
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException(e.getMessage(), e);
        }
    }
223765
@Override
    public void setAsText(final String text) {
        if (BeanUtils.isNull(text)) {
            setValue(null);
            return;
        }
        try {
            Object newValue = Long.valueOf(text);
            setValue(newValue);
        } catch (NumberFormatException e) {
            throw new IllegalArgumentException("Failed to parse long.", e);
        }
    }
125794
private Document parseText(String text) throws DocumentException {
        Document result;

        String encoding = getEncoding(text);

        InputSource source = new InputSource(new StringReader(text));
        source.setEncoding(encoding);

        result = reader.read(source);

        // if the XML parser doesn't provide a way to retrieve the encoding,
        // specify it manually
        if (result.getXMLEncoding() == null) {
            result.setXMLEncoding(encoding);
        }

        return result;
    }
669022
public String decode(String text) {
    if (text == null) { return null; }
    if ((!text.startsWith(Prefix)) || (!text.endsWith(Postfix)))
      throw new IllegalArgumentException("RFC 1522 violation: malformed encoded content");
    int terminator = text.length() - 2;
    int from = 2;
    int to = text.indexOf(Sep, from);
    if (to == terminator) throw new IllegalArgumentException("RFC 1522 violation: charset token not found");
    String charset = text.substring(from, to);
    if (charset.equals("")) throw new IllegalArgumentException("RFC 1522 violation: charset not specified");
    from = to + 1;
    to = text.indexOf(Sep, from);
    if (to == terminator) throw new IllegalArgumentException("RFC 1522 violation: encoding token not found");
    String encoding = text.substring(from, to);
    if (!getEncoding().equalsIgnoreCase(encoding))
      throw new IllegalArgumentException("This codec cannot decode " + encoding + " encoded content");
    from = to + 1;
    to = text.indexOf(Sep, from);
    return new String(Base64.decode(text.substring(from, to).toCharArray()), Charset.forName(charset));
  }
896346
private static String decode(final String text)
        throws UnsupportedEncodingException {
        try {
            return URLDecoder.decode(text, Charset.defaultCharset().name());
        } catch (final IllegalArgumentException ex) {
            throw new DecodingException(ex);
        }
    }
1100280
private ArrayList<ArrayList<String>> parseString(String text) {

        ArrayList<ArrayList<String>> result = new ArrayList<ArrayList<String>>();
        StringTokenizer linetoken = new StringTokenizer(text, "\n");
        StringTokenizer token;
        String current;
        while (linetoken.hasMoreTokens()) {
            current = linetoken.nextToken();
            if (current.contains(",")) {
                token = new StringTokenizer(current, ",");
            } else {
                token = new StringTokenizer(current);
            }
            ArrayList<String> line = new ArrayList<String>();
            while (token.hasMoreTokens()) {
                line.add(token.nextToken());
            }
            result.add(line);
        }
        return result;
    }
677103
public <T> T decode(String source, Class<? extends T> cls) {

        return net.arnx.jsonic.JSON.decode(source, cls);
    }
370138
public String encryptText(String text)
	throws Exception
	{
		return toByteText(this.encrypt(text.getBytes(IO.CHARSET)));

	}
1034082
public static function decode($string)
    {
        if (! is_string($string)) {
            throw new JsonException('Json decode parameter must be a string');
        }

        $result = json_decode($string, true);

        if ($result === null) {
            throw new JsonException('Json decode error');
        }
        return $result;
    }
1184746
protected boolean isObject(String text) {
        final String trim = text.trim();
        return trim.startsWith("{") && trim.endsWith("}");
    }
470517
private static String escapeJSON(String text) {
        StringBuilder builder = new StringBuilder();

        builder.append('"');
        for (int index = 0; index < text.length(); index++) {
            char chr = text.charAt(index);

            switch (chr) {
                case '"':
                case '\\':
                    builder.append('\\');
                    builder.append(chr);
                    break;
                case '\b':
                    builder.append("\\b");
                    break;
                case '\t':
                    builder.append("\\t");
                    break;
                case '\n':
                    builder.append("\\n");
                    break;
                case '\r':
                    builder.append("\\r");
                    break;
                default:
                    if (chr < ' ') {
                        String t = "000" + Integer.toHexString(chr);
                        builder.append("\\u" + t.substring(t.length() - 4));
                    } else {
                        builder.append(chr);
                    }
                    break;
            }
        }
        builder.append('"');

        return builder.toString();
    }