11package com .sourcegraph .scip_semanticdb ;
22
3- import com .google .protobuf .util .JsonFormat ;
43import org .scip_code .scip .Index ;
54
65import java .io .BufferedOutputStream ;
76import java .io .IOException ;
8- import java .nio .charset .StandardCharsets ;
97import java .nio .file .Files ;
108import java .nio .file .Path ;
119import java .nio .file .StandardCopyOption ;
@@ -17,7 +15,6 @@ public class ScipWriter implements AutoCloseable {
1715 private final Path tmp ;
1816 private final ScipOutputStream output ;
1917 private final ScipSemanticdbOptions options ;
20- private final JsonFormat .Printer jsonPrinter ;
2118
2219 public ScipWriter (ScipSemanticdbOptions options ) throws IOException {
2320 if (OperatingSystem .isWindows ()) {
@@ -29,22 +26,12 @@ public ScipWriter(ScipSemanticdbOptions options) throws IOException {
2926 "index.scip" ,
3027 PosixFilePermissions .asFileAttribute (PosixFilePermissions .fromString ("rw-r--r--" )));
3128 }
32- this .output =
33- new ScipOutputStream (options .format , new BufferedOutputStream (Files .newOutputStream (tmp )));
29+ this .output = new ScipOutputStream (new BufferedOutputStream (Files .newOutputStream (tmp )));
3430 this .options = options ;
35- this .jsonPrinter = JsonFormat .printer ().omittingInsignificantWhitespace ();
3631 }
3732
3833 public void emitTyped (Index index ) {
39- try {
40- if (options .format .isNewlineDelimitedJSON ()) {
41- this .output .write (jsonPrinter .print (index ).getBytes (StandardCharsets .UTF_8 ));
42- } else {
43- this .output .write (index .toByteArray ());
44- }
45- } catch (IOException e ) {
46- options .reporter .error (e );
47- }
34+ this .output .write (index .toByteArray ());
4835 }
4936
5037 public void build () throws IOException {
0 commit comments