use of org.flywaydb.core.internal.util.BomStrippingReader in project flyway by flyway.
the class Parser method parse.
/**
* Parses this resource into a stream of statements.
*
* @param resource The resource to parse.
* @param metadata The resource's metadata.
* @return The statements.
*/
public final SqlStatementIterator parse(LoadableResource resource, SqlScriptMetadata metadata) {
PositionTracker tracker = new PositionTracker();
Recorder recorder = new Recorder();
ParserContext context = new ParserContext(getDefaultDelimiter());
String filename = resource.getFilename();
LOG.debug("Parsing " + filename + " ...");
ResourceName result = new ResourceNameParser(configuration).parse(filename);
parsingContext.updateFilenamePlaceholder(result);
PeekingReader peekingReader = new PeekingReader(new RecordingReader(recorder, new PositionTrackingReader(tracker, replacePlaceholders(new BomStrippingReader(new UnboundedReadAheadReader(new BufferedReader(resource.read(), 4096))), metadata))), supportsPeekingMultipleLines());
return new ParserSqlStatementIterator(peekingReader, resource, recorder, tracker, context);
}
Aggregations