Class MBStyleParser


  • public class MBStyleParser
    extends Object
    Given JSON input (as a String or Reader, parses and returns a MBStyle.
    Author:
    Torben Barsballe (Boundless)
    • Constructor Summary

      Constructors 
      Constructor Description
      MBStyleParser()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      MBStyle parse​(InputStream json)
      Parse the provided json into MBStyle.
      MBStyle parse​(Reader json)
      Parse the provided json into MBStyle.
      MBStyle parse​(String json)
      Parse the provided json into MBStyle.
      • Methods inherited from class Object

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

      • MBStyleParser

        public MBStyleParser()
    • Method Detail

      • parse

        public MBStyle parse​(String json)
                      throws ParseException,
                             MBFormatException
        Parse the provided json into MBStyle.

        Please be aware that MBStyle.is a thin wrapper around the provided json and will lazily parse map box style contents as required.

        Parameters:
        json - String
        Returns:
        MBStyle
        Throws:
        ParseException - If JSON is not well formed
        MBFormatException - If MapBox Style is obviously not well formed
      • parse

        public MBStyle parse​(Reader json)
                      throws ParseException,
                             IOException,
                             MBFormatException
        Parse the provided json into MBStyle.

        Please be aware that MBStyle.is a thin wrapper around the provided json and will lazily parse map box style contents as required.

        Parameters:
        json - Reader
        Returns:
        MBStyle
        Throws:
        ParseException - If JSON is not well formed
        IOException - If json reader cannot be read
        MBFormatException - If MapBox Style is obviously not well formed
      • parse

        public MBStyle parse​(InputStream json)
                      throws ParseException,
                             IOException,
                             MBFormatException
        Parse the provided json into MBStyle.

        Please be aware that MBStyle.is a thin wrapper around the provided json and will lazily parse map box style contents as required.

        Parameters:
        json - InputStream
        Returns:
        MBStyle
        Throws:
        ParseException - If JSON is not well formed
        IOException - If json input stream cannot be read
        MBFormatException - If MapBox Style is obviously not well formed