001package org.unix4j.unix.sed; 002 003import org.unix4j.line.Line; 004import org.unix4j.line.SimpleLine; 005import org.unix4j.processor.LineProcessor; 006 007class AppendProcessor extends AbstractTextProcessor { 008 public AppendProcessor(Command command, SedArguments args, LineProcessor output) { 009 super(command, args, output); 010 } 011 public AppendProcessor(Command command, String script, SedArguments args, LineProcessor output) { 012 super(command, script, args, output); 013 } 014 015 @Override 016 public boolean processLine(Line line) { 017 final boolean matches = regexp.matcher(line).find(); 018 if (matches || !args.isQuiet()) { 019 if (!output.processLine(line)) { 020 return false; 021 } 022 } 023 if (matches) { 024 return output.processLine(new SimpleLine(text, line.getLineEnding())); 025 } 026 return true; 027 } 028}