Package org.codehaus.jackson

Examples of org.codehaus.jackson.JsonFactory.createJsonParser()


        writer.endObject();
    }
   
    static public ReconCandidate loadStreaming(String s) throws Exception {
        JsonFactory jsonFactory = new JsonFactory();
        JsonParser jp = jsonFactory.createJsonParser(s);
       
        if (jp.nextToken() != JsonToken.START_OBJECT) {
            return null;
        }
        return loadStreaming(jp);
View Full Code Here


            loadStreaming(s, pool);
    }
   
    static public Row loadStreaming(String s, Pool pool) throws Exception {
        JsonFactory jsonFactory = new JsonFactory();
        JsonParser jp = jsonFactory.createJsonParser(s);
       
        if (jp.nextToken() != JsonToken.START_OBJECT) {
            return null;
        }
       
View Full Code Here

    private void _testIsNextTokenName1(boolean useStream) throws Exception
    {
        final String DOC = "{\"name\":123,\"name2\":14,\"x\":\"name\"}";
        JsonFactory jf = new JsonFactory();
        JsonParser jp = useStream ?
            jf.createJsonParser(new ByteArrayInputStream(DOC.getBytes("UTF-8")))
            : jf.createJsonParser(new StringReader(DOC));
        SerializedString NAME = new SerializedString("name");
        assertFalse(jp.nextFieldName(NAME));
        assertToken(JsonToken.START_OBJECT, jp.getCurrentToken());
        assertTrue(jp.nextFieldName(NAME));
View Full Code Here

    {
        final String DOC = "{\"name\":123,\"name2\":14,\"x\":\"name\"}";
        JsonFactory jf = new JsonFactory();
        JsonParser jp = useStream ?
            jf.createJsonParser(new ByteArrayInputStream(DOC.getBytes("UTF-8")))
            : jf.createJsonParser(new StringReader(DOC));
        SerializedString NAME = new SerializedString("name");
        assertFalse(jp.nextFieldName(NAME));
        assertToken(JsonToken.START_OBJECT, jp.getCurrentToken());
        assertTrue(jp.nextFieldName(NAME));
        assertToken(JsonToken.FIELD_NAME, jp.getCurrentToken());
View Full Code Here

    private void _testIsNextTokenName2(boolean useStream) throws Exception
    {
        final String DOC = "{\"name\":123,\"name2\":14,\"x\":\"name\"}";
        JsonFactory jf = new JsonFactory();
        JsonParser jp = useStream ?
            jf.createJsonParser(new ByteArrayInputStream(DOC.getBytes("UTF-8")))
            : jf.createJsonParser(new StringReader(DOC));
        SerializableString NAME = new SerializedString("name");
        assertFalse(jp.nextFieldName(NAME));
        assertToken(JsonToken.START_OBJECT, jp.getCurrentToken());
        assertTrue(jp.nextFieldName(NAME));
View Full Code Here

    {
        final String DOC = "{\"name\":123,\"name2\":14,\"x\":\"name\"}";
        JsonFactory jf = new JsonFactory();
        JsonParser jp = useStream ?
            jf.createJsonParser(new ByteArrayInputStream(DOC.getBytes("UTF-8")))
            : jf.createJsonParser(new StringReader(DOC));
        SerializableString NAME = new SerializedString("name");
        assertFalse(jp.nextFieldName(NAME));
        assertToken(JsonToken.START_OBJECT, jp.getCurrentToken());
        assertTrue(jp.nextFieldName(NAME));
        assertToken(JsonToken.FIELD_NAME, jp.getCurrentToken());
View Full Code Here

        .getOperator(Operator.Type.ImportMapGeometryFromJson);

    JsonFactory jf = new JsonFactory();
    JsonParser jp = null;
    try {
      jp = jf.createJsonParser(jsonString);
      jp.nextToken();
    } catch (Exception ex) {
    }
    MapGeometry mapGeom = importerJSON.execute(Geometry.Type.Unknown, jp);
    return mapGeom;
View Full Code Here

  }

  public static OGCGeometry fromJson(String string)
      throws JsonParseException, IOException {
    JsonFactory factory = new JsonFactory();
    JsonParser jsonParserPt = factory.createJsonParser(string);
    jsonParserPt.nextToken();
    MapGeometry mapGeom = GeometryEngine.jsonToGeometry(jsonParserPt);
    return OGCGeometry.createFromEsriGeometry(mapGeom.getGeometry(),
        mapGeom.getSpatialReference());
  }
View Full Code Here

    ean_url += "customerUserAgent=" + this.customerUserAgent;
    ean_url = ean_url.replaceAll(" ", "%20");
   
    try {
      JsonFactory factory= new JsonFactory();
      JsonParser parser = factory.createJsonParser(new URL(ean_url));
      while (parser.nextToken() != JsonToken.END_OBJECT) {
        String fieldname = parser.getCurrentName();
        if (fieldname != null && fieldname.equals("HotelSummary")) {
          if (parser.nextToken() == JsonToken.START_ARRAY) {
            while(parser.nextToken() != JsonToken.END_ARRAY){
View Full Code Here

    if (!nextPageToken.isEmpty()) {
      url += "&pagetoken=" + nextPageToken;
      nextPageToken = "";
    }
    try {
      JsonParser parser = factory.createJsonParser(new URL(url));
      // loop until token equal to "}"
      while (parser.nextToken() != JsonToken.END_OBJECT) {
        String fieldname = parser.getCurrentName();
        if ("html_attributions".equals(fieldname)) {
          parser.nextToken();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.