@@ -0,0 +1,2884 @@
+/*%0A * Copyright 2020 Google Inc.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage com.google.android.gms.samples.wallet.util;%0A%0Aimport android.content.Context;%0Aimport org.json.JSONArray;%0Aimport org.json.JSONException;%0A%0Aimport java.io.BufferedReader;%0Aimport java.io.InputStream;%0Aimport java.io.InputStreamReader;%0Aimport java.util.stream.Collectors;%0A%0A/**%0A * Utility class to work with JSON content stored locally.%0A */%0Apublic class Json %7B%0A%0A    /**%0A     * Loads a resource and creates a %7B@link JSONArray%7D object with the contents of the binary.%0A     *%0A     * @param context where the execution is taking place.%0A     * @param fileName path that points to the target binary.%0A     * @return a %7B@link JSONArray%7D object with the contents of the stream.%0A     */%0A    public static JSONArray readFromFile(Context context, String fileName) %7B%0A        try %7B%0A            final InputStream inputStream = context.getAssets().open(fileName);%0A            return readFromInputStream(inputStream);%0A%0A        %7D catch (Exception e)%7B%0A            return new JSONArray();%0A        %7D%0A    %7D%0A%0A    /**%0A     * Loads a resource and creates a %7B@link JSONArray%7D object with the contents of the binary.%0A     *%0A     * @param context where the execution is taking place.%0A     * @param resource identifier of the binary in the resource folders.%0A     * @return a %7B@link JSONArray%7D object with the contents of the stream.%0A     */%0A    public static JSONArray readFromResources(Context context, int resource) %7B%0A        try %7B%0A            final InputStream inputStream = context.getResources().openRawResource(resource);%0A            return readFromInputStream(inputStream);%0A%0A        %7D catch (Exception e)%7B%0A            return new JSONArray();%0A        %7D%0A    %7D%0A%0A    /**%0A     * Create a %7B@link JSONArray%7D with the contents of an %7B@link InputStream%7D holding%0A     * JSON information.%0A     *%0A     * @param inputStream containing the JSON bytes.%0A     * @return a %7B@link JSONArray%7D object with the contents of the stream.%0A     * @throws JSONException if the content could not be parsed.%0A     */%0A    private static JSONArray readFromInputStream(InputStream inputStream) throws JSONException %7B%0A        final BufferedReader reader =  new BufferedReader(new InputStreamReader(inputStream));%0A        final String inputString = reader.lines().collect(Collectors.joining());%0A        return new JSONArray(inputString);%0A    %7D%0A%0A%7D

Add Json utility to load content from files in the resource folders