< prev index next >

src/jdk.jartool/share/classes/sun/tools/jar/Main.java

Print this page

        

@@ -74,11 +74,11 @@
  * format, with optional meta-information stored in a MANIFEST entry.
  */
 public
 class Main {
     String program;
-    PrintStream out, err;
+    PrintWriter out, err;
     String fname, mname, ename;
     String zname = "";
     String rootjar = null;
 
     private static final int BASE_VERSION = 0;

@@ -187,13 +187,13 @@
         HELP(GNUStyleOptions::printHelp),
         COMPAT_HELP(GNUStyleOptions::printCompatHelp),
         USAGE_SUMMARY(GNUStyleOptions::printUsageSummary),
         VERSION(GNUStyleOptions::printVersion);
 
-        private Consumer<PrintStream> printFunction;
-        Info(Consumer<PrintStream> f) { this.printFunction = f; }
-        void print(PrintStream out) { printFunction.accept(out); }
+        private Consumer<PrintWriter> printFunction;
+        Info(Consumer<PrintWriter> f) { this.printFunction = f; }
+        void print(PrintWriter out) { printFunction.accept(out); }
     };
     Info info;
 
     /* Modular jar related options */
     boolean printModuleDescriptor;

@@ -250,10 +250,16 @@
         args[1] = arg1;
         return MessageFormat.format(msg, (Object[]) args);
     }
 
     public Main(PrintStream out, PrintStream err, String program) {
+        this.out = new PrintWriter(out, true);
+        this.err = new PrintWriter(err, true);
+        this.program = program;
+    }
+
+    public Main(PrintWriter out, PrintWriter err, String program) {
         this.out = out;
         this.err = err;
         this.program = program;
     }
 
< prev index next >