Package net.sf.json.util

Examples of net.sf.json.util.JSONBuilder


    osw.flush();
  }
 
  @Override
  public void write(Writer writer) throws Exception {
    JSONBuilder builder = new JSONBuilder(writer);
    write(builder);
  }
View Full Code Here


    }
   
    private void writeJSON(Writer outWriter, DescribeLayerModel description) throws IOException {

        try {
            JSONBuilder json = new JSONBuilder(outWriter);
            final List<LayerDescription> layers = description.getLayerDescriptions();
            json.object();
            json.key("version").value(description.getVersion());
            json.key("layerDescriptions");
            json.array();
            for (LayerDescription layer : layers) {
                json.object();
                json.key("layerName").value(layer.getName());
                URL url = layer.getOwsURL();
                json.key("owsURL").value(url != null ? url.toString() : "");
                json.key("owsType").value(layer.getOwsType());
                json.key("typeName").value(layer.getName());
                json.endObject();
            }
            json.endArray();
            json.endObject();
        } catch (JSONException jsonException) {
            ServiceException serviceException = new ServiceException("Error: "
                    + jsonException.getMessage());
            serviceException.initCause(jsonException);
            throw serviceException;
View Full Code Here

    write(osw);
    osw.flush();
  }
 
  public void write(Writer writer) throws Exception {
    JSONBuilder builder = new JSONBuilder(writer);
    builder.object();
    writeDirectory(builder, top);
    builder.endObject();
  }
View Full Code Here

TOP

Related Classes of net.sf.json.util.JSONBuilder

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.