class QueryStatementSplitter {

    public List<String> split(String input) {
        List<String> statements = new ArrayList<String>();
        StrBuilder currentSql = new StrBuilder();

        StrTokenizer lineTokenizer = new StrTokenizer(input);
        lineTokenizer.setDelimiterMatcher(StrMatcher.charSetMatcher("\r\n"));

        for (String line : lineTokenizer.getTokenArray()) {
	        String strippedLine = StringUtils.stripEnd(line, null);
            if (!currentSql.isEmpty()) {
                currentSql.append(lineEnding.get());
            }

            currentSql.append(strippedLine);

           if (delimiterType.matches(strippedLine, delimiter)) {
                statements.add(currentSql.substring(0, currentSql.length() - delimiter.length()));
                currentSql.clear();
            }
        }

        if (!currentSql.isEmpty()) {
            statements.add(currentSql.toString());
        }
        
        return statements;
    }

    public  QueryStatementSplitter();

}