Search in sources :

Example 1 with BomStrippingReader

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);
}
Also used : ResourceName(org.flywaydb.core.internal.resource.ResourceName) BomStrippingReader(org.flywaydb.core.internal.util.BomStrippingReader) ResourceNameParser(org.flywaydb.core.internal.resource.ResourceNameParser) BufferedReader(java.io.BufferedReader)

Aggregations

BufferedReader (java.io.BufferedReader)1 ResourceName (org.flywaydb.core.internal.resource.ResourceName)1 ResourceNameParser (org.flywaydb.core.internal.resource.ResourceNameParser)1 BomStrippingReader (org.flywaydb.core.internal.util.BomStrippingReader)1