01: package de.regnis.q.sequence.line.simplifier;
02:
03: /**
04: * @author Marc Strapetz
05: */
06: public class QSequenceLineWhiteSpaceSkippingSimplifier implements
07: QSequenceLineSimplifier {
08:
09: // Static =================================================================
10:
11: public static String removeWhiteSpaces(String text) {
12: final StringBuffer buffer = new StringBuffer();
13: for (int index = 0; index < text.length(); index++) {
14: final char ch = text.charAt(index);
15: if (ch != '\n' && ch != '\r' && Character.isWhitespace(ch)) {
16: continue;
17: }
18:
19: buffer.append(ch);
20: }
21:
22: return buffer.toString();
23: }
24:
25: // Implemented ============================================================
26:
27: public byte[] simplify(byte[] bytes) {
28: return removeWhiteSpaces(new String(bytes)).getBytes();
29: }
30: }
|