Class JsArrayParser


  • public final class JsArrayParser
    extends java.lang.Object
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      JsArray parse​(byte[] bytes)
      parses an array of bytes into a Json array that must conform the spec of the parser.
      JsArray parse​(java.io.InputStream inputstream)
      parses an input stream of bytes into a Json array that must conform the spec of the parser.
      JsArray parse​(java.lang.String str)
      parses a string into a Json array that must conform the spec of the parser.
      • Methods inherited from class java.lang.Object

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

      • JsArrayParser

        public JsArrayParser​(JsArraySpec spec)
        Parameters:
        spec - the Json spec what defines the schema that every element in the array has to conform
    • Method Detail

      • parse

        public JsArray parse​(byte[] bytes)
        parses an array of bytes into a Json array that must conform the spec of the parser. If the array of bytes doesn't represent a well-formed Json or is a well-formed Json that doesn't conform the spec of the parser, a ParsingException failure wrapped in a Try computation is returned.
        Parameters:
        bytes - a Json array serialized in an array of bytes
        Returns:
        a try computation with the result
      • parse

        public JsArray parse​(java.lang.String str)
        parses a string into a Json array that must conform the spec of the parser. If the string doesn't represent a well-formed Json array or is a well-formed Json that doesn't conform the spec of the parser, a ParsingException failure wrapped in a Try computation is returned.
        Parameters:
        str - a Json array serialized in a string
        Returns:
        a try computation with the result
      • parse

        public JsArray parse​(java.io.InputStream inputstream)
        parses an input stream of bytes into a Json array that must conform the spec of the parser. If the the input stream of bytes doesn't represent a well-formed Json array or is a well-formed Json that doesn't conform the spec of the parser, a ParsingException failure wrapped in a Try computation is returned. Any I/O exception processing the input stream is wrapped in a Try computation as well
        Parameters:
        inputstream - the input stream of bytes
        Returns:
        a try computation with the result