/*
 * Copyright 2016 Finn Bock
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.github.bckfnn.taggersty;

/**
 * An <code>TagsOutput</code> implementation that append the output to a StringBuffer.
 */
public class StringBuilderOutput implements TagsOutput {
    private StringBuilder sb = new StringBuilder(1024*9);

    @Override
    public void write(String s) {
        sb.append(s);
    }

    @Override
    public void write(char c) {
        sb.append(c);
    }

    @Override
    public String toString() {
        return sb.toString();
    }
    
    @Override
    public void close() {
        // Empty
    }
}
@@ -1,11 +1,10 @@
 /*
-%0D
 %0A * Copy
@@ -23,21 +23,19 @@
 inn Bock
-%0D
 %0A *
-%0D
 %0A * Lice
@@ -93,17 +93,16 @@
 cense%22);
-%0D
 %0A * you 
@@ -161,17 +161,16 @@
 License.
-%0D
 %0A * You 
@@ -204,21 +204,19 @@
 cense at
-%0D
 %0A *
-%0D
 %0A *     
@@ -262,13 +262,11 @@
 -2.0
-%0D
 %0A *
-%0D
 %0A * 
@@ -332,17 +332,16 @@
 software
-%0D
 %0A * dist
@@ -401,17 +401,16 @@
 %22 BASIS,
-%0D
 %0A * WITH
@@ -477,17 +477,16 @@
 implied.
-%0D
 %0A * See 
@@ -548,17 +548,16 @@
 ions and
-%0D
 %0A * limi
@@ -582,22 +582,20 @@
 License.
-%0D
 %0A */
-%0D
 %0Apackage
@@ -626,16 +626,13 @@
 sty;
-%0D%0A%0D
+%0A
 %0A/**
-%0D
 %0A * 
@@ -718,14 +718,12 @@
 fer.
-%0D
 %0A */
-%0D
 %0Apub
@@ -775,17 +775,16 @@
 Output %7B
-%0D
 %0A    pri
@@ -833,15 +833,15 @@
 1024
-*9);%0D%0A%0D
+ * 8);%0A
 %0A   
@@ -842,33 +842,32 @@
 ;%0A%0A    @Override
-%0D
 %0A    public void
@@ -884,17 +884,16 @@
 ing s) %7B
-%0D
 %0A       
@@ -906,26 +906,23 @@
 pend(s);
-%0D
 %0A    %7D
-%0D%0A%0D
+%0A
 %0A    @Ov
@@ -919,33 +919,32 @@
 %7D%0A%0A    @Override
-%0D
 %0A    public void
@@ -959,17 +959,16 @@
 har c) %7B
-%0D
 %0A       
@@ -985,18 +985,15 @@
 (c);
-%0D
 %0A    %7D
-%0D%0A%0D
+%0A
 %0A   
@@ -994,33 +994,32 @@
 %7D%0A%0A    @Override
-%0D
 %0A    public Stri
@@ -1029,25 +1029,24 @@
 toString() %7B
-%0D
 %0A        ret
@@ -1067,22 +1067,15 @@
 g();
-%0D
 %0A    %7D
-%0D%0A    %0D
+%0A
 %0A   
@@ -1084,17 +1084,16 @@
 Override
-%0D
 %0A    pub
@@ -1110,17 +1110,16 @@
 lose() %7B
-%0D
 %0A       
@@ -1131,14 +1131,12 @@
 mpty
-%0D
 %0A    %7D
-%0D
 %0A%7D

use a 8 kb buffer.