modules/jdk.packager/src/main/java/com/sun/javafx/tools/packager/CachingPrintStream.java

Print this page




  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.javafx.tools.packager;
  27 
  28 import java.io.PrintStream;
  29 




  30 public class CachingPrintStream {
  31 
  32     private PrintStream ps;
  33     private StringBuilder sb;
  34 
  35     public CachingPrintStream(PrintStream ps) {
  36         this.ps = ps;
  37         sb = new StringBuilder();
  38     }
  39 
  40     public void println(String s) {
  41         sb.append(s).append('\n');
  42         ps.println(s);
  43     }
  44 
  45     public String getString() {
  46         return sb.toString();
  47     }
  48 
  49     public void flush() {


  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.javafx.tools.packager;
  27 
  28 import java.io.PrintStream;
  29 
  30 /**
  31  * @deprecated use {@link ToolProvider} to locate the {@code "javapackager"} tool instead.
  32  */
  33 @Deprecated(since="10", forRemoval=true)
  34 public class CachingPrintStream {
  35 
  36     private PrintStream ps;
  37     private StringBuilder sb;
  38 
  39     public CachingPrintStream(PrintStream ps) {
  40         this.ps = ps;
  41         sb = new StringBuilder();
  42     }
  43 
  44     public void println(String s) {
  45         sb.append(s).append('\n');
  46         ps.println(s);
  47     }
  48 
  49     public String getString() {
  50         return sb.toString();
  51     }
  52 
  53     public void flush() {