1010import com .fasterxml .jackson .databind .module .SimpleModule ;
1111import org .eclipse .cdt .core .dom .ast .IASTTranslationUnit ;
1212
13- import java .io .ByteArrayOutputStream ;
13+ import java .io .OutputStream ;
14+ import java .io .PrintStream ;
1415import java .io .IOException ;
1516
1617class TranslationUnitJSONMapper implements IExchangeFormatWritter {
1718
1819 final JsonGenerator generator ;
1920 final JsonFactory jsonFactory = new JsonFactory ();
2021 final ObjectMapper mapper = new ObjectMapper ();
21- private ByteArrayOutputStream byteOutputStream ;
22+ private OutputStream printStream ;
2223
23- TranslationUnitJSONMapper (boolean prettyPrint , ByteArrayOutputStream byteOutput ) throws IOException {
24- this .byteOutputStream = byteOutput ;
24+ TranslationUnitJSONMapper (boolean prettyPrint , PrintStream byteOutput ) throws IOException {
25+ this .printStream = byteOutput ;
2526
26- generator = jsonFactory .createGenerator (byteOutputStream );
27+ generator = jsonFactory .createGenerator (printStream );
2728 if (prettyPrint ) {
2829 generator .setPrettyPrinter (new DefaultPrettyPrinter ());
2930 mapper .enable (SerializationFeature .INDENT_OUTPUT );
@@ -40,7 +41,7 @@ public void writeValue(DriverResponse response) throws IOException {
4041 mapper .writeValue (generator , response );
4142 }
4243
43- public ByteArrayOutputStream getByteOutputStream () {
44- return byteOutputStream ;
44+ public OutputStream getOutputStream () {
45+ return printStream ;
4546 }
4647}
0 commit comments