Class GeoJSONUtil


  • public class GeoJSONUtil
    extends Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static String DATE_FORMAT
      Date format (ISO 8601)
      static FastDateFormat dateFormatter  
      static TimeZone TIME_ZONE  
    • Constructor Summary

      Constructors 
      Constructor Description
      GeoJSONUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean addOrdinate​(List<Object> ordinates, Object value)  
      static StringBuilder array​(String key, Object value, StringBuilder sb)  
      static Coordinate createCoordinate​(List ordinates)  
      static Coordinate[] createCoordinates​(List<Coordinate> coordinates)  
      static void encode​(String json, Object output)  
      static void encode​(Map<String,​Object> obj, Object output)  
      static StringBuilder entry​(String key, Object value, StringBuilder sb)  
      static StringBuilder nul​(StringBuilder sb)  
      static <T> T parse​(IContentHandler<T> handler, Object input, boolean trace)  
      static StringBuilder string​(String string, StringBuilder sb)  
      static Reader toReader​(Object input)
      Converts an object to a Reader instance.
      static Writer toWriter​(Object output)
      Converts an object to Writer instance.
      static <T> T trace​(T handler, Class<T> clazz)  
      • Methods inherited from class Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DATE_FORMAT

        public static final String DATE_FORMAT
        Date format (ISO 8601)
        See Also:
        Constant Field Values
      • TIME_ZONE

        public static final TimeZone TIME_ZONE
      • dateFormatter

        public static final FastDateFormat dateFormatter
    • Constructor Detail

      • GeoJSONUtil

        public GeoJSONUtil()
    • Method Detail

      • toReader

        public static Reader toReader​(Object input)
                               throws IOException
        Converts an object to a Reader instance.

        The input parameter may be one of the following types:

        • Reader
        • InputStream
        • File
        • String *
        * A string parameter is considered a file path.
        Parameters:
        input - The input object.
        Returns:
        A reader.
        Throws:
        IOException
      • toWriter

        public static Writer toWriter​(Object output)
                               throws IOException
        Converts an object to Writer instance.

        The output parameter may be one of the following types:

        • Writer
        • OutputStream
        • File
        • String *
        * A string parameter is considered a file path.
        Parameters:
        output - The output object.
        Returns:
        A writer.
        Throws:
        IOException
      • string

        public static StringBuilder string​(String string,
                                           StringBuilder sb)
      • entry

        public static StringBuilder entry​(String key,
                                          Object value,
                                          StringBuilder sb)
      • array

        public static StringBuilder array​(String key,
                                          Object value,
                                          StringBuilder sb)
      • nul

        public static StringBuilder nul​(StringBuilder sb)
      • trace

        public static <T> T trace​(T handler,
                                  Class<T> clazz)
      • addOrdinate

        public static boolean addOrdinate​(List<Object> ordinates,
                                          Object value)
      • createCoordinate

        public static Coordinate createCoordinate​(List ordinates)
                                           throws ParseException
        Throws:
        ParseException
      • createCoordinates

        public static Coordinate[] createCoordinates​(List<Coordinate> coordinates)
      • parse

        public static <T> T parse​(IContentHandler<T> handler,
                                  Object input,
                                  boolean trace)
                           throws IOException
        Throws:
        IOException
      • encode

        public static void encode​(String json,
                                  Object output)
                           throws IOException
        Throws:
        IOException
      • encode

        public static void encode​(Map<String,​Object> obj,
                                  Object output)
                           throws IOException
        Throws:
        IOException