All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.regnis.q.sequence.line.simplifier.QSequenceLineEOLUnifyingSimplifier Maven / Gradle / Ivy

Go to download

The only pure Java Subversion library in the world, formerly known as JavaSVN

The newest version!
package de.regnis.q.sequence.line.simplifier;

/**
 * @author Marc Strapetz
 */
public class QSequenceLineEOLUnifyingSimplifier implements QSequenceLineSimplifier {

	// Implemented ============================================================

	public byte[] simplify(byte[] bytes) {
		String line = new String(bytes);
		boolean trimmed = false;
		while (line.endsWith("\n") || line.endsWith("\r")) {
			line = line.substring(0, line.length() - 1);
			trimmed = true;
		}

		if (trimmed) {
			line += "\n";
		}

		return line.getBytes();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy