java 读取resource里的文件


InputStream fin = FlinkETL.class.getResourceAsStream("/dim_product_tag.sql");
InputStreamReader reader = new InputStreamReader(fin);
BufferedReader buffReader = new BufferedReader(reader);
String strSql = "";
String line = "";
strSql = buffReader.readLine();
while ((line = buffReader.readLine()) != null) {
strSql = strSql + line + "\n";
}

String[] sl = strSql.split(";");
for(int i=0;i<sl.length;i++){
System.out.println("================");
System.out.println(sl[i]);
tEnv.executeSql(sl[i]);
}
posted @ 2021-10-08 16:03  yjy888  阅读(549)  评论(0编辑  收藏  举报