package jp.itohiro.wgb.lang;

import org.eclipse.collections.api.list.MutableList;
import org.eclipse.collections.impl.list.mutable.ListAdapter;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Properties;

public class Main {

    public static void main(String[] args) throws IOException {
        String sourceFile="";
        Properties p = new Properties();
        InputStreamReader inputStreamReader = new InputStreamReader(new FileInputStream(Paths.get(Main.class.getClassLoader().getResource("wgb.properties").getPath()).toFile()), Charset.forName("UTF-8"));
        if(args.length == 1){
            sourceFile = args[0];
        }
        else if(args.length == 2){
            String propertiesFile = args[0];
            URL propertiesFileResource = Main.class.getClassLoader().getResource(propertiesFile);
            if(propertiesFileResource == null){
                throw new FileNotFoundException("Properties file not existing: " + propertiesFile);
            }
            String propertiesFilePath = propertiesFileResource.getPath();
            inputStreamReader = new InputStreamReader(new FileInputStream(Paths.get(propertiesFilePath).toFile()), Charset.forName("UTF-8"));
            sourceFile = args[1];
        }
        else{
            System.out.println("Usage: wagakki-band-lang [operation mapping file] sourceFile");
            System.exit(1);
        }
        p.load(inputStreamReader);
        inputStreamReader.close();
        MutableList<String> sourceLines = ListAdapter.adapt(Files.readAllLines(Paths.get(sourceFile)));
        String source = sourceLines.makeString("");
        BFEngine engine = new BFEngine(source, p);
        engine.run();
    }
}

@@ -158,123 +158,9 @@
 .io.
-FileInputStream;%0Aimport java.io.FileNotFoundException;%0Aimport java.io.IOException;%0Aimport java.io.InputStreamReader
+*
 ;%0Aim
@@ -525,38 +525,8 @@
 der(
-new FileInputStream(Paths.get(
 Main
@@ -560,16 +560,24 @@
 Resource
+AsStream
 (%22wgb.pr
@@ -590,29 +590,8 @@
 es%22)
-.getPath()).toFile())
 , Ch
@@ -781,19 +781,27 @@
         
-URL
+InputStream
  propert
@@ -807,24 +807,27 @@
 tiesFile
-Resource
+InputStream
  = Main.
@@ -860,16 +860,24 @@
 Resource
+AsStream
 (propert
@@ -915,24 +915,27 @@
 tiesFile
-Resource
+InputStream
  == null
@@ -1067,183 +1067,75 @@
     
-String propertiesFilePath = propertiesFileResource.getPath();%0A            inputStreamReader = new InputStreamReader(new FileInputStream(Paths.get(propertiesFilePath).toFile())
+inputStreamReader = new InputStreamReader(propertiesFileInputStream
 , Ch

Handle resource in jar file.