/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.facebook.presto.plugin.geospatial;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;

public class GeometryBenchmarkUtils
{
    private GeometryBenchmarkUtils() {}

    public static String loadPolygon(String fileName)
            throws IOException
    {
        Path filePath = Paths.get(GeometryBenchmarkUtils.class.getClassLoader().getResource(fileName).getPath());
        List<String> lines = Files.readAllLines(filePath);
        String line = lines.get(0);
        String[] parts = line.split("\\|");
        return parts[0];
    }
}

@@ -648,48 +648,94 @@
 va.n
-io.file.Files
+et.URL;%0Aimport java.util.List
 ;%0A
+%0A
 import 
-java.nio.file.Path
+static com.google.common.io.Resources.readLines
 ;%0Aim
@@ -735,24 +735,31 @@
 nes;%0Aimport 
+static 
 java.nio.fil
@@ -759,18 +759,38 @@
 nio.
-file.Paths
+charset.StandardCharsets.UTF_8
 ;%0Aim
@@ -786,32 +786,39 @@
 s.UTF_8;%0Aimport 
+static 
 java.util.List;%0A
@@ -811,20 +811,38 @@
 va.util.
-List
+Objects.requireNonNull
 ;%0A%0Apubli
@@ -959,24 +959,20 @@
 (String 
-fileName
+path
 )%0A      
@@ -1014,33 +1014,37 @@
     
-Path filePath = Paths.get
+URL resource = requireNonNull
 (Geo
@@ -1102,27 +1102,44 @@
 rce(
-fileName).getP
+path), %22resource not found: %22 + p
 ath
-()
 );%0A 
@@ -1170,35 +1170,33 @@
 s = 
-Files.
 read
-All
 Lines(
-filePath
+resource, UTF_8
 );%0A 

Improve GeometryBenchmarkUtils#loadPolygon