tiny-grpc/grpc_server/src/main/java/utils/ServerRouteGuideUtil.java
/**
     * Parses the JSON input file containing the list of features.
     */
Parses the JSON input file containing the list of features.
Parses the JSON input file containing the list of features .
public static List<RouteGuideOuterClass.Feature> parseFeatures(URL file) throws IOException {
        InputStream input = file.openStream();
        try {
            Reader reader = new InputStreamReader(input, Charset.forName("UTF-8"));
            try {
                RouteGuideOuterClass.FeatureDatabase.Builder database = RouteGuideOuterClass.FeatureDatabase.newBuilder();
                JsonFormat.parser().merge(reader, database);
                return database.getFeatureList();
            } finally {
                reader.close();
            }
        } finally {
            input.close();
        }
    }
public static List < RouteGuideOuterClass . Feature > parseFeatures ( URL file ) throws IOException { InputStream input = file . openStream ( ) ; try { Reader reader = new InputStreamReader ( input , Charset . forName ( "UTF-8" ) ) ; try { RouteGuideOuterClass . FeatureDatabase . Builder database = RouteGuideOuterClass . FeatureDatabase . newBuilder ( ) ; JsonFormat . parser ( ) . merge ( reader , database ) ; return database . getFeatureList ( ) ; } finally { reader . close ( ) ; } } finally { input . close ( ) ; } }
Parses the JSON input file containing the list of features.
Parses the JSON input file containing the list of features .