Package org.codehaus.jackson

Examples of org.codehaus.jackson.JsonFactory


  }

  private static JsonGenerator getJsonGenerator(OutputStream out)
    throws IOException {
    return out == null ? null :
      new JsonFactory().createJsonGenerator(out, JsonEncoding.UTF8);
  }
View Full Code Here


           
        }
    }

    public Bpmn2Resource unmarshall(String json, String preProcessingData) throws JsonParseException, IOException {
        return unmarshall(new JsonFactory().createJsonParser(json), preProcessingData);
    }
View Full Code Here

    public Bpmn2Resource unmarshall(String json, String preProcessingData) throws JsonParseException, IOException {
        return unmarshall(new JsonFactory().createJsonParser(json), preProcessingData);
    }

    public Bpmn2Resource unmarshall(File file, String preProcessingData) throws JsonParseException, IOException {
        return unmarshall(new JsonFactory().createJsonParser(file), preProcessingData);
    }
View Full Code Here

  private static JsonGenerator getJsonGenerator(OutputStream out, boolean pretty)
      throws IOException {
    if (null == out)
      throw new NullPointerException("OutputStream cannot be null");
    JsonGenerator g
      = new JsonFactory().createJsonGenerator(out, JsonEncoding.UTF8);
    if (pretty) {
      DefaultPrettyPrinter pp = new DefaultPrettyPrinter() {
        //@Override
        public void writeRootValueSeparator(JsonGenerator jg)
            throws IOException
View Full Code Here

    {
        File manifestFile = cfs.directories.getOrCreateLeveledManifest();
        File oldFile = new File(manifestFile.getPath().replace(EXTENSION, "-old.json"));
        File tmpFile = new File(manifestFile.getPath().replace(EXTENSION, "-tmp.json"));

        JsonFactory f = new JsonFactory();
        try
        {
            JsonGenerator g = f.createJsonGenerator(tmpFile, JsonEncoding.UTF8);
            g.useDefaultPrettyPrinter();
            g.writeStartObject();
            g.writeArrayFieldStart("generations");
            for (int level = 0; level < generations.length; level++)
            {
View Full Code Here

    {
        File manifestFile = cfs.directories.getOrCreateLeveledManifest();
        File oldFile = new File(manifestFile.getPath().replace(EXTENSION, "-old.json"));
        File tmpFile = new File(manifestFile.getPath().replace(EXTENSION, "-tmp.json"));

        JsonFactory f = new JsonFactory();
        try
        {
            FileOutputStream fos = new FileOutputStream(tmpFile);
            JsonGenerator g = f.createJsonGenerator(fos, JsonEncoding.UTF8);
            g.useDefaultPrettyPrinter();
            g.writeStartObject();
            g.writeArrayFieldStart("generations");
            for (int level = 0; level < generations.length; level++)
            {
View Full Code Here

        if (manifestFile == null)
            manifestFile = new File(new File(DatabaseDescriptor.getAllDataFileLocations()[0], cfs.table.name), cfs.columnFamily + ".json");
        File oldFile = new File(manifestFile.getPath().replace(EXTENSION, "-old.json"));
        File tmpFile = new File(manifestFile.getPath().replace(EXTENSION, "-tmp.json"));

        JsonFactory f = new JsonFactory();
        try
        {
            JsonGenerator g = f.createJsonGenerator(tmpFile, JsonEncoding.UTF8);
            g.useDefaultPrettyPrinter();
            g.writeStartObject();
            g.writeArrayFieldStart("generations");
            for (int level = 0; level < generations.length; level++)
            {
View Full Code Here

      }
    }

    StringWriter sw = new StringWriter();
    try {
      JsonFactory f = new JsonFactory();
      JsonGenerator g = f.createJsonGenerator(sw);

      g.writeStartObject();

      // write id field
      g.writeRaw("\n  ");
View Full Code Here

    Map<String, List<String>> listFields = Maps.newHashMap();
    Map<String, Map<String, String>> mapFields = Maps.newHashMap();
    byte[] rawPayload = null;

    try {
      JsonFactory f = new JsonFactory();
      JsonParser jp = f.createJsonParser(bais);

      jp.nextToken(); // will return JsonToken.START_OBJECT (verify?)
      while (jp.nextToken() != JsonToken.END_OBJECT) {
        String fieldname = jp.getCurrentName();
        jp.nextToken(); // move to value, or START_OBJECT/START_ARRAY
View Full Code Here

            File assumptionFile = new File(assumptionDirectory, "assumptions.json");
            if (assumptionFile.isFile())
            {
                try
                {
                    JsonFactory f = new JsonFactory();
                    JsonParser p = f.createJsonParser(assumptionFile);
                    JsonToken token = p.nextToken();
                    while (token != JsonToken.END_OBJECT)
                    {
                        if (token == JsonToken.FIELD_NAME)
                        {
View Full Code Here

TOP

Related Classes of org.codehaus.jackson.JsonFactory

Copyright © 2018 www.massapicom. 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.