Class TextComparator
java.lang.Object
org.eclipse.tycho.zipcomparator.internal.TextComparator
- All Implemented Interfaces:
ContentsComparator
@Component(role=ContentsComparator.class,
hint="txt")
public class TextComparator
extends Object
implements ContentsComparator
Compares text-like files by ignoring there line ending styles
-
Field Summary
Fields inherited from interface org.eclipse.tycho.zipcomparator.internal.ContentsComparator
THRESHOLD -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ArtifactDeltacompareText(ComparatorInputStream baseline, ComparatorInputStream reactor, ArtifactComparator.ComparisonData data) static ArtifactDeltacreateDelta(String message, ComparatorInputStream baseline, ComparatorInputStream reactor, ArtifactComparator.ComparisonData data) getDelta(ComparatorInputStream baseline, ComparatorInputStream reactor, ArtifactComparator.ComparisonData data) Computes the delta for the givenInputStreams, the streams passed will support mark/reset for repeated reads.static booleanisEqualTextIngoreNewLine(byte[] baseline, byte[] reactor) Tests ifbaselineandreactorcontain equal text, if line-endings are ignored.booleanCheck if this comparator matches the given name or extension
-
Constructor Details
-
TextComparator
public TextComparator()
-
-
Method Details
-
getDelta
public ArtifactDelta getDelta(ComparatorInputStream baseline, ComparatorInputStream reactor, ArtifactComparator.ComparisonData data) throws IOException Description copied from interface:ContentsComparatorComputes the delta for the givenInputStreams, the streams passed will support mark/reset for repeated reads.- Specified by:
getDeltain interfaceContentsComparator- Parameters:
baseline- the baseline datareactor- the reactor data or current project state- Returns:
- the
ArtifactDeltaorArtifactDelta.NO_DIFFERENCEif the content is semantically the same - Throws:
IOException
-
compareText
public static ArtifactDelta compareText(ComparatorInputStream baseline, ComparatorInputStream reactor, ArtifactComparator.ComparisonData data) -
isEqualTextIngoreNewLine
public static boolean isEqualTextIngoreNewLine(byte[] baseline, byte[] reactor) Tests ifbaselineandreactorcontain equal text, if line-endings are ignored. -
matches
Description copied from interface:ContentsComparatorCheck if this comparator matches the given name or extension- Specified by:
matchesin interfaceContentsComparator- Parameters:
nameOrExtension- the extension or name to match- Returns:
trueif this comparator matches,falseotherwise
-
createDelta
public static ArtifactDelta createDelta(String message, ComparatorInputStream baseline, ComparatorInputStream reactor, ArtifactComparator.ComparisonData data)
-