01: package de.regnis.q.sequence.line.simplifier;
02:
03: /**
04: * @author Marc Strapetz
05: */
06: public class QSequenceLineEOLUnifyingSimplifier implements
07: QSequenceLineSimplifier {
08:
09: // Implemented ============================================================
10:
11: public byte[] simplify(byte[] bytes) {
12: String line = new String(bytes);
13: boolean trimmed = false;
14: while (line.endsWith("\n") || line.endsWith("\r")) {
15: line = line.substring(0, line.length() - 1);
16: trimmed = true;
17: }
18:
19: if (trimmed) {
20: line += "\n";
21: }
22:
23: return line.getBytes();
24: }
25: }
|