Here you can find the source of readSqlStatements(URL url)
Parameter | Description |
---|---|
url | url of the file |
private static String[] readSqlStatements(URL url)
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.io.InputStreamReader; import java.net.URL; public class Main { /**/* www .j a v a 2 s .co m*/ * Reads SQL statements from file. SQL commands in file must be separated by * a semicolon. * * @param url url of the file * @return array of command strings */ private static String[] readSqlStatements(URL url) { try { char buffer[] = new char[256]; StringBuilder result = new StringBuilder(); InputStreamReader reader = new InputStreamReader(url.openStream(), "UTF-8"); while (true) { int count = reader.read(buffer); if (count < 0) { break; } result.append(buffer, 0, count); } return result.toString().split(";"); } catch (IOException ex) { throw new RuntimeException("Cannot read " + url, ex); } } }