Class ReadArrJSON


  • public class ReadArrJSON
    extends java.lang.Object
    Utilities for parsing Json Array's into Java Array's.
    See Also:
    JsonArray


Stateless Class: This class neither contains any program-state, nor can it be instantiated. The @StaticFunctional Annotation may also be called 'The Spaghetti Report'. Static-Functional classes are, essentially, C-Styled Files, without any constructors or non-static member field. It is very similar to the Java-Bean @Stateless Annotation.
  • 1 Constructor(s), 1 declared private, zero-argument constructor
  • 22 Method(s), 22 declared static
  • 7 Field(s), 7 declared static, 7 declared final


    • Method Summary

       
      Read a JsonArray into a Java Primitive-Stream
      Modifier and Type Method
      static DoubleStream doubleArrayToStream​(JsonArray ja, double defaultValue, int FLAGS, Function<String,​Double> optionalUserParser)
      static IntStream intArrayToStream​(JsonArray ja, int defaultValue, int FLAGS, Function<String,​Integer> optionalUserParser)
      static LongStream longArrayToStream​(JsonArray ja, long defaultValue, int FLAGS, Function<String,​Long> optionalUserParser)
       
      Read a JsonArray into a Java Stream of Boxed-Type Numbers
      Modifier and Type Method
      static Stream<Byte> byteArrayToBoxedStream​(JsonArray ja, byte defaultValue, int FLAGS, Function<String,​Byte> optionalUserParser)
      static Stream<Double> doubleArrayToBoxedStream​(JsonArray ja, double defaultValue, int FLAGS, Function<String,​Double> optionalUserParser)
      static Stream<Float> floatArrayToBoxedStream​(JsonArray ja, float defaultValue, int FLAGS, Function<String,​Float> optionalUserParser)
      static Stream<Integer> integerArrayToBoxedStream​(JsonArray ja, int defaultValue, int FLAGS, Function<String,​Integer> optionalUserParser)
      static Stream<Long> longArrayToBoxedStream​(JsonArray ja, long defaultValue, int FLAGS, Function<String,​Long> optionalUserParser)
      static Stream<Short> shortArrayToBoxedStream​(JsonArray ja, short defaultValue, int FLAGS, Function<String,​Short> optionalUserParser)
       
      Read a JsonArray into a Java-Array
      Modifier and Type Method
      static byte[] byteArray​(JsonArray ja, byte defaultValue, int FLAGS, Function<String,​Byte> optionalUserParser)
      static float[] floatArray​(JsonArray ja, float defaultValue, int FLAGS, Function<String,​Float> optionalUserParser)
      static short[] shortArray​(JsonArray ja, short defaultValue, int FLAGS, Function<String,​Short> optionalUserParser)
       
      Read a JsonArray into a Java Stream<String> or String[]-Array
      Modifier and Type Method
      static Stream<String> strArrayToStream​(JsonArray ja, String defaultValue, int FLAGS)
       
      Protected, Internal Methods
      Modifier and Type Method
      protected static void jsonArrToBoxedStream​(JsonArray ja, Torello.Java.Additional.ReadArrJSON.RECORD2 rec)
      protected static void jsonArrToStream​(JsonArray ja, Torello.Java.Additional.ReadArrJSON.RECORD rec)
      • Methods inherited from class java.lang.Object

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

      • jsonArrToStream

        🡇    
        protected static void jsonArrToStream​
                    (JsonArray ja,
                     Torello.Java.Additional.ReadArrJSON.RECORD rec)
        
        Builds a Primitive-Stream from a JsonArray
        Parameters:
        ja - Any JsonArray, composed of number.
        rec - The configurations
        Code:
        Exact Method Body:
         int SIZE = ja.size();
        
         for (int i=0; i < SIZE; i++)
         {
             JsonValue jv = ja.get(i);
        
             switch (jv.getValueType())
             {
                 // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
                 case NULL:
                 // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
        
                     if (rec.RD_N) rec.streamBuilder.accept(rec.defaultValue);
        
                     else if (rec.S_N) continue;
        
                     else throw new JsonNullPrimitiveArrException(ja, i, NUMBER, rec.CLASS);
        
                     break;
        
        
                 // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
                 case NUMBER:
                 // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
        
                     JsonNumber jn = (JsonNumber) jv;
                     Number      n = jn.numberValue();
        
                     // Guaranteed to work properly ==> This is the "definition of RJA_AEX"
                     //
                     // "numberConverter" is just Number.intValue, longValue, doubleValue
                     // Number.intValue(), longValue(), doubleValue() **DO NOT** throw any
                     // exceptions.  They round (if necessary), or return MAX_INT, MAX_LONG, etc...
                     // (also, only if necessary)
                     //
                     // numberConverter: Number.intValue(), Number.longValue(), Number.doubleValue()
                     // jsonNumWillFit: A Predicate that I wrote, just checks the size of the number
        
                     if (    rec.RJA_AEX
                         ||  rec.jsonNumWillFit.test(jn)
                         )
                         rec.streamBuilder.accept(rec.numberConverter.apply(n));
        
                     else if (rec.RD_AEX) rec.streamBuilder.accept(rec.defaultValue);
        
                     else if (rec.S_AEX) continue;
        
                     else throw new JsonArithmeticArrException
                         (getAEX(jn, rec.numberConverterExThrow), ja, i, NUMBER, jv, rec.CLASS);
        
                     break;
        
        
                 // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
                 case STRING:
                 // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
        
                     String s = ((JsonString) jv).getString();
        
                     if (rec.hasUserParser)
        
                         try
                             { rec.streamBuilder.accept(rec.userParser.apply(s)); }
        
                         catch (Exception e)
                         {
                             if (rec.RD_SPEX) rec.streamBuilder.accept(rec.defaultValue);
        
                             else throw new JsonStrParseArrException(e, ja, i, jv, rec.CLASS);
                         }
        
                     else if (rec.RP_S)
                     {
                         if (s.length() == 0)
                         {
                             if (rec.RD_ZLS) rec.streamBuilder.accept(rec.defaultValue);
        
                             else if (rec.S_ZLS) continue;
        
                             else throw new JsonStrParseArrException(
                                 new IllegalArgumentException("Zero Length String"),
                                 ja, i, jv, rec.CLASS
                             );
                         }
        
                         // StringParse.isInteger(s), isLong(String) **AND** s -> true (Double)
                         else if (rec.validStrTester.test(s))
        
                             // Integer.parseInt(String), Long.parseLong, Double.parseDouble
                             rec.streamBuilder.accept(rec.defaultParser.apply(s));
        
                         else if (rec.RD_SPEX) rec.streamBuilder.accept(rec.defaultValue);
        
                         else if (rec.S_SPEX) continue;
        
                         else throw new JsonStrParseArrException
                             (getSPEX(s, rec.defaultParser), ja, i, jv, rec.CLASS);
                     }
        
                     else if (rec.RD_S) rec.streamBuilder.accept(rec.defaultValue);
        
                     else if (rec.S_S) continue;
        
                     else throw new JsonTypeArrException(ja, i, NUMBER, jv, rec.CLASS);
        
                     break;
        
        
                 // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
                 default:
                 // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
        
                     if (rec.RD_WT) rec.streamBuilder.accept(rec.defaultValue);
        
                     else if (rec.S_WT) continue;
        
                     else throw new JsonTypeArrException(ja, i, NUMBER, jv, rec.CLASS);
             }
         }
        
      • intArrayToStream

        🡅  🡇    
        public static java.util.stream.IntStream intArrayToStream​
                    (JsonArray ja,
                     int defaultValue,
                     int FLAGS,
                     java.util.function.Function<java.lang.String,​java.lang.Integer> optionalUserParser)
        
        Creates an instance of java.util.stream.IntStream from a JsonArray.
        Parameters:
        ja - Any JsonArray composed of integers.
        defaultValue - The default-value used in error-cases, as long as the appropriate flag has been set.
        Returns:
        An instance of java.util.stream.IntStream populated by the contents of 'ja'.

        IMPORTANT: Producing a standard java int[] array is a trivial-converstion, just call IntStream.toArray().
        Code:
        Exact Method Body:
         IntStream.Builder b = IntStream.builder();
        
         jsonArrToStream(
             ja, 
             new RECORD<>(
                 defaultValue, 
                 FLAGS,
                 x -> b.accept(x),           // Stream.Builder "accept" Function-Pointer
                 int.class,                  // Class of the Stream.Builder "accept" Parameter
                 (JsonNumber jn) -> Integer.class == jn.numberValue().getClass(),
                 StringParse::isInteger,     // String-tester (for parsing number-strings)
                 Integer::parseInt,          // default-parser (number-string to int)
                 Number::intValue,           // numberConverter
                 BigDecimal::intValueExact,  // Generates AEX (ArithmeticException)
                 optionalUserParser
             )
         );
        
         return b.build();
        
      • longArrayToStream

        🡅  🡇    
        public static java.util.stream.LongStream longArrayToStream​
                    (JsonArray ja,
                     long defaultValue,
                     int FLAGS,
                     java.util.function.Function<java.lang.String,​java.lang.Long> optionalUserParser)
        
        Creates an instance of java.util.stream.LongStream from a JsonArray.
        Parameters:
        ja - Any JsonArray composed of long-integers.
        defaultValue - The default-value used in error-cases, as long as the appropriate flag has been set.
        Returns:
        An instance of java.util.stream.LongStream populated by the contents of 'ja'.

        IMPORTANT: Producing a standard java long[] array is a trivial-converstion, just call LongStream.toArray().
        Code:
        Exact Method Body:
         LongStream.Builder b = LongStream.builder();
        
         jsonArrToStream(
             ja,
             new RECORD<>(
                 defaultValue,
                 FLAGS,
                 x -> b.accept(x),           // Stream.Builder "accept" Function-Pointer
                 long.class,                 // Class of the Stream.Builder "accept" Parameter
                 ReadArrJSON::longTypePred,  // Checks the JsonNumber retrieved
                 StringParse::isLong,        // String-tester (for parsing number-strings)
                 Long::parseLong,            // default-parser (number-string to long)
                 Number::longValue,          // numberConverter
                 BigDecimal::longValueExact, // Generates AEX (ArithmeticException)
                 optionalUserParser
             )
         );
        
         return b.build();
        
      • doubleArrayToStream

        🡅  🡇    
        public static java.util.stream.DoubleStream doubleArrayToStream​
                    (JsonArray ja,
                     double defaultValue,
                     int FLAGS,
                     java.util.function.Function<java.lang.String,​java.lang.Double> optionalUserParser)
        
        Creates an instance of java.util.stream.DoubleStream from a JsonArray.
        Parameters:
        ja - Any JsonArray composed of floating-point doubles.
        defaultValue - The default-value used in error-cases, as long as the appropriate flag has been set.
        Returns:
        An instance of java.util.stream.DoubleStream populated by the contents of 'ja'.

        IMPORTANT: Producing a standard java double[] array is a trivial-converstion, just call DoubleStream.toArray().
        Code:
        Exact Method Body:
         DoubleStream.Builder b = DoubleStream.builder();
        
         jsonArrToStream(
             ja,
             new RECORD<>(
                 defaultValue,
                 FLAGS,
                 x -> b.accept(x),               // Stream.Builder "accept" Function-Pointer
                 double.class,                   // Class of the Stream.Builder "accept" Parameter
                 ReadArrJSON::doubleTypePred,    // Checks the JsonNumber retrieved
                 StringParse::isDouble,          // String-tester (for parsing number-strings)
                 Double::parseDouble,            // default-parser (number-string to double)
                 (Number n) -> n.doubleValue(),  // numberConverter
                 (BigDecimal bd) -> { throw new ArithmeticException("Invalid Input"); },
                 optionalUserParser
             )
         );
        
         return b.build();
        
      • jsonArrToBoxedStream

        🡅  🡇    
        protected static void jsonArrToBoxedStream​
                    (JsonArray ja,
                     Torello.Java.Additional.ReadArrJSON.RECORD2 rec)
        
        Builds a Stream of Boxed-Type Numbers from a JsonArray
        Parameters:
        ja - Any JsonArray, composed of number.
        rec - The configurations
        Code:
        Exact Method Body:
         int SIZE = ja.size();
        
         for (int i=0; i < SIZE; i++)
         {
             JsonValue jv = ja.get(i);
        
             switch (jv.getValueType())
             {
                 // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
                 case NULL:
                 // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
        
                     if (rec.RN_N) rec.streamBuilder.accept(null);
        
                     else if (rec.RD_N) rec.streamBuilder.accept(rec.defaultValue);
        
                     else if (rec.S_N) continue;
        
                     else rec.streamBuilder.accept(null);
        
                     break;
        
        
                 // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
                 case NUMBER:
                 // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
        
                     JsonNumber jn = (JsonNumber) jv;
                     Number      n = jn.numberValue();
        
                     // Guaranteed to work properly ==> This is the "definition of RJA_AEX"
                     //
                     // Number.intValue(), longValue(), doubleValue() **DO NOT** throw any
                     // exceptions.  They round (if necessary), or return MAX_INT, MAX_LONG, etc...
                     // (also, only if necessary)
                     //
                     // numberConverter: Number.intValue(), Number.longValue(), Number.doubleValue()
                     // jsonNumWillFit: A Predicate that I wrote, just checks the size of the number
        
                     if (    rec.RJA_AEX
                         ||  rec.jsonNumWillFit.test(jn)
                         )
                         rec.streamBuilder.accept(rec.numberConverter.apply(n));
        
                     else if (rec.RN_AEX) rec.streamBuilder.accept(null);
        
                     else if (rec.RD_AEX) rec.streamBuilder.accept(rec.defaultValue);
        
                     else if (rec.S_AEX) continue;
        
                     else
                     {  
                         throw new JsonArithmeticArrException
                             (getAEX(jn, rec.numberConverterExThrow), ja, i, NUMBER, jv, rec.CLASS);
                     }
        
                     break;
        
        
                 // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
                 case STRING:
                 // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
        
                     String s = ((JsonString) jv).getString();
        
                     if (rec.hasUserParser)
        
                         try
                             { rec.streamBuilder.accept(rec.userParser.apply(s)); }
        
                         catch (Exception e)
                         {
                             if (rec.RN_SPEX) rec.streamBuilder.accept(null);
        
                             else if (rec.RD_SPEX) rec.streamBuilder.accept(rec.defaultValue);
        
                             else throw new JsonStrParseArrException(e, ja, i, jv, rec.CLASS);
                         }
        
                     else if (rec.RP_S)
                     {
                         if (s.length() == 0)
                         {
                             if (rec.RN_ZLS) rec.streamBuilder.accept(null);
                
                             else if (rec.RD_ZLS) rec.streamBuilder.accept(rec.defaultValue);
        
                             else if (rec.S_ZLS) continue;
        
                             else throw new JsonStrParseArrException(
                                 new IllegalArgumentException("Zero Length String"),
                                 ja, i, jv, rec.CLASS
                             );
                         }
        
                         // StringParse.isInteger(s), isLong(String) **AND** s -> true (Double)
                         else if (rec.validStrTester.test(s))
        
                             // Integer.parseInt(String), Long.parseLong, Double.parseDouble
                             rec.streamBuilder.accept(rec.defaultParser.apply(s));
        
                         else if (rec.RN_SPEX) rec.streamBuilder.accept(null);
        
                         else if (rec.RD_SPEX) rec.streamBuilder.accept(rec.defaultValue);
        
                         else if (rec.S_SPEX) continue;
        
                         else throw new JsonStrParseArrException
                             (getSPEX(s, rec.defaultParser), ja, i, jv, rec.CLASS);
                     }
        
                     else if (rec.RN_S) rec.streamBuilder.accept(null);
        
                     else if (rec.RD_S) rec.streamBuilder.accept(rec.defaultValue);
        
                     else if (rec.S_S) continue;
        
                     else throw new JsonTypeArrException(ja, i, NUMBER, jv, rec.CLASS);
        
                     break;
        
        
                 // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
                 default:
                 // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
        
                     if (rec.RN_WT) rec.streamBuilder.accept(null);
        
                     else if (rec.RD_WT) rec.streamBuilder.accept(rec.defaultValue);
        
                     else if (rec.S_WT) continue;
        
                     else throw new JsonTypeArrException(ja, i, NUMBER, jv, rec.CLASS);
             }
         }
        
      • shortArray

        🡅  🡇    
        public static short[] shortArray​
                    (JsonArray ja,
                     short defaultValue,
                     int FLAGS,
                     java.util.function.Function<java.lang.String,​java.lang.Short> optionalUserParser)
        
        Convenience Method

        Invokes: shortArrayToBoxedStream(JsonArray, short, int, Function)

        Converts Stream<Short> to short[]
        Code:
        Exact Method Body:
         short[] ret = new short[ja.size()];
         Counter i   = new Counter(-1);
        
         FLAGS = FLAGS % NOT_ALLOWED_RET_NULL_MASKS;
        
         shortArrayToBoxedStream(ja, defaultValue, FLAGS, optionalUserParser)
             .forEachOrdered((Short s) -> ret[i.addOne()] = s);
        
         return ret;
        
      • byteArray

        🡅  🡇    
        public static byte[] byteArray​
                    (JsonArray ja,
                     byte defaultValue,
                     int FLAGS,
                     java.util.function.Function<java.lang.String,​java.lang.Byte> optionalUserParser)
        
        Convenience Method

        Invokes: byteArrayToBoxedStream(JsonArray, byte, int, Function)

        Converts Stream<Byte> to byte[]
        Code:
        Exact Method Body:
         byte[]  ret = new byte[ja.size()];
         Counter i   = new Counter(-1);
        
         FLAGS = FLAGS % NOT_ALLOWED_RET_NULL_MASKS;
        
         byteArrayToBoxedStream(ja, defaultValue, FLAGS, optionalUserParser)
             .forEachOrdered((Byte s) -> ret[i.addOne()] = s);
        
         return ret;
        
      • floatArray

        🡅  🡇    
        public static float[] floatArray​
                    (JsonArray ja,
                     float defaultValue,
                     int FLAGS,
                     java.util.function.Function<java.lang.String,​java.lang.Float> optionalUserParser)
        
        Convenience Method

        Invokes: floatArrayToBoxedStream(JsonArray, float, int, Function)

        Converts Stream<Float> to float[]
        Code:
        Exact Method Body:
         float[] ret = new float[ja.size()];
         Counter i   = new Counter(-1);
        
         FLAGS = FLAGS % NOT_ALLOWED_RET_NULL_MASKS;
        
         floatArrayToBoxedStream(ja, defaultValue, FLAGS, optionalUserParser)
             .forEachOrdered((Float s) -> ret[i.addOne()] = s);
        
         return ret;
        
      • integerArrayToBoxedStream

        🡅  🡇    
        public static java.util.stream.Stream<java.lang.Integer> integerArrayToBoxedStream​
                    (JsonArray ja,
                     int defaultValue,
                     int FLAGS,
                     java.util.function.Function<java.lang.String,​java.lang.Integer> optionalUserParser)
        
        Code:
        Exact Method Body:
         Stream.Builder<Integer> b = Stream.builder();
        
         jsonArrToBoxedStream(
             ja,
             new RECORD2<>(
                 defaultValue,
                 FLAGS,
                 x -> b.accept(x),           // Stream.Builder "accept" Function-Pointer
                 Integer.class,              // Class of the Stream.Builder "accept" Parameter
                 (JsonNumber jn) -> jn.numberValue().getClass() == Integer.class,
                 StringParse::isInteger,     // String-tester (for parsing number-strings)
                 Integer::parseInt,          // default-parser (number-string to Integer)
                 Number::intValue,           // numberConverter (JAPPROX_ON_AEX *AND* usual-ans)
                 BigDecimal::intValueExact,  // Generates AEX on fail
                 optionalUserParser
             )
         );
        
         return b.build();
        
      • shortArrayToBoxedStream

        🡅  🡇    
        public static java.util.stream.Stream<java.lang.Short> shortArrayToBoxedStream​
                    (JsonArray ja,
                     short defaultValue,
                     int FLAGS,
                     java.util.function.Function<java.lang.String,​java.lang.Short> optionalUserParser)
        
        Code:
        Exact Method Body:
         Stream.Builder<Short> b = Stream.builder();
        
         jsonArrToBoxedStream(
             ja,
             new RECORD2<>(
                 defaultValue,
                 FLAGS,
                 x -> b.accept(x),               // Stream.Builder "accept" Function-Pointer
                 Short.class,                    // Class of the Stream.Builder "accept" Parameter
                 ReadArrJSON::shortTypePred,     // Checks the JsonNumber retrieved
                 StringParse::isShort,           // String-tester (for parsing number-strings)
                 Short::parseShort,              // default-parser (number-string to short)
                 Number::shortValue,             // numberConverter (JAPPROX_ON_AEX *AND* usual-ans)
                 BigDecimal::shortValueExact,    // Generates AEX on fail
                 optionalUserParser
             )
         );
        
         return b.build();
        
      • byteArrayToBoxedStream

        🡅  🡇    
        public static java.util.stream.Stream<java.lang.Byte> byteArrayToBoxedStream​
                    (JsonArray ja,
                     byte defaultValue,
                     int FLAGS,
                     java.util.function.Function<java.lang.String,​java.lang.Byte> optionalUserParser)
        
        Code:
        Exact Method Body:
         Stream.Builder<Byte> b = Stream.builder();
        
         jsonArrToBoxedStream(
             ja,
             new RECORD2<>(
                 defaultValue,
                 FLAGS,
                 x -> b.accept(x),           // Stream.Builder "accept" Function-Pointer
                 Byte.class,                 // Class of the Stream.Builder "accept" Parameter
                 ReadArrJSON::byteTypePred,  // Checks the JsonNumber retrieved
                 StringParse::isByte,        // String-tester (for parsing number-strings)
                 Byte::parseByte,            // default-parser (number-string to byte)
                 Number::byteValue,          // numberConverter (JAPPROX_ON_AEX *AND* usual-ans)
                 BigDecimal::byteValueExact, // Generates AEX on fail
                 optionalUserParser
             )
         );
        
         return b.build();
        
      • longArrayToBoxedStream

        🡅  🡇    
        public static java.util.stream.Stream<java.lang.Long> longArrayToBoxedStream​
                    (JsonArray ja,
                     long defaultValue,
                     int FLAGS,
                     java.util.function.Function<java.lang.String,​java.lang.Long> optionalUserParser)
        
        Code:
        Exact Method Body:
         Stream.Builder<Long> b = Stream.builder();
        
         jsonArrToBoxedStream(
             ja,
             new RECORD2<>(
                 defaultValue,
                 FLAGS,
                 x -> b.accept(x),           // Stream.Builder "accept" Function-Pointer
                 Long.class,                 // Class of the Stream.Builder "accept" Parameter
                 ReadArrJSON::longTypePred,  // Checks the JsonNumber retrieved
                 StringParse::isLong,        // String-tester (for parsing number-strings)
                 Long::parseLong,            // default-parser (number-string to long)
                 Number::longValue,          // numberConverter (JAPPROX_ON_AEX *AND* usual-ans)
                 BigDecimal::longValueExact, // Generates AEX on fail
                 optionalUserParser
             )
         );
        
         return b.build();
        
      • doubleArrayToBoxedStream

        🡅  🡇    
        public static java.util.stream.Stream<java.lang.Double> doubleArrayToBoxedStream​
                    (JsonArray ja,
                     double defaultValue,
                     int FLAGS,
                     java.util.function.Function<java.lang.String,​java.lang.Double> optionalUserParser)
        
        Code:
        Exact Method Body:
         Stream.Builder<Double> b = Stream.builder();
        
         jsonArrToBoxedStream(
             ja,
             new RECORD2<>(
                 defaultValue,
                 FLAGS,
                 x -> b.accept(x),               // Stream.Builder "accept" Function-Pointer
                 Double.class,                   // Class of the Stream.Builder "accept" Parameter
                 ReadArrJSON::doubleTypePred,    // Checks the JsonNumber retrieved
                 StringParse::isDouble,          // String-tester (for parsing number-strings)
                 Double::parseDouble,            // default-parser (number-string to double)
                 Number::doubleValue,            // numberConverter (JAPPROX_ON_AEX *AND* usual-ans)
                 (BigDecimal bd) -> { throw new ArithmeticException("Invalid Input"); },
                 optionalUserParser
             )
         );
        
         return b.build();
        
      • floatArrayToBoxedStream

        🡅  🡇    
        public static java.util.stream.Stream<java.lang.Float> floatArrayToBoxedStream​
                    (JsonArray ja,
                     float defaultValue,
                     int FLAGS,
                     java.util.function.Function<java.lang.String,​java.lang.Float> optionalUserParser)
        
        Code:
        Exact Method Body:
         Stream.Builder<Float> b = Stream.builder();
        
         jsonArrToBoxedStream(
             ja,
             new RECORD2<>(
                 defaultValue,
                 FLAGS,
                 x -> b.accept(x),           // Stream.Builder "accept" Function-Pointer
                 Float.class,                // Class of the Stream.Builder "accept" Parameter
                 ReadArrJSON::floatTypePred, // Checks the JsonNumber retrieved
                 StringParse::isDouble,      // String-tester (for parsing number-strings)
                 Float::parseFloat,          // default-parser (number-string to float)
                 Number::floatValue,         // numberConverter (JAPPROX_ON_AEX *AND* usual-ans)
                 (BigDecimal bd) -> { throw new ArithmeticException("Invalid Input"); },
                 optionalUserParser
             )
         );
        
         return b.build();
        
      • strArrayToStream

        🡅    
        public static java.util.stream.Stream<java.lang.String> strArrayToStream​
                    (JsonArray ja,
                     java.lang.String defaultValue,
                     int FLAGS)
        
        Converts a JsonArray into a Stream<String>. A Java Stream<String> is easily converted to a String[]-Array via a call to Stream.toArray(String[]::new).
        Parameters:
        ja - Any JsonArray, but preferrably one which contains instances of JsonString
        defaultValue - When used in conjunction with 'FLAGS', this default-value may be inserted into the output-array when error cases occur at particular array-index locations.
        FLAGS - Optional flags. See JFlag for details.
        Returns:
        A Java Stream<String>.
        Code:
        Exact Method Body:
         int SIZE = ja.size();
        
         Stream.Builder<String> b = Stream.builder();
        
         RECORD2 rec = new RECORD2<>
             (defaultValue, FLAGS, null, null, null, null, null, null, null, null);
        
         boolean RTS_WT = (FLAGS & RETURN_TOSTRING_ON_WRONGTYPE) > 0;
        
         for (int i=0; i < SIZE; i++)
         {
             JsonValue jv = ja.get(i);
        
             switch (jv.getValueType())
             {
                 // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
                 case NULL:
                 // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
        
                     if (rec.RN_N) b.accept(null);
        
                     else if (rec.RD_N) b.accept(defaultValue);
        
                     else if (rec.S_N) continue;
        
                     else b.accept(null);
        
                     break;
        
        
                 // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
                 case STRING:
                 // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
        
                     b.accept(((JsonString) jv).getString());
        
                     break;
        
        
                 // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
                 default:
                 // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
        
                     if (RTS_WT) b.accept(jv.toString());
        
                     else if (rec.RN_WT) b.accept(null);
        
                     else if (rec.RD_WT) b.accept(defaultValue);
        
                     else if (rec.S_WT) continue;
        
                     else throw new JsonTypeArrException(ja, i, STRING, jv, String.class);
             }
         }
        
         return b.build();