All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.yworks.yshrink.util.XmlLogger Maven / Gradle / Ivy

Go to download

The open-source Java obfuscation tool working with Ant and Gradle by yWorks - the diagramming experts

There is a newer version: 4.1.1
Show newest version
package com.yworks.yshrink.util;

import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringReader;

/**
 * @author Michael Schroeder, yWorks GmbH http://www.yworks.com
 */
public class XmlLogger extends Logger {

  private PrintWriter pw;

  public XmlLogger( PrintWriter pw ) {
    this.pw = pw;
    pw.println("");
    pw.println("");
    register();
  }

  public void doLog( String s ) {
    pw.println( "" );
  }

  public void doErr( String s ) {
    pw.println( "" );
  }

  public void doErr( String s, Throwable ex ) {
    pw.println( "" );
  }

  public void doWarn( String s ) {
    pw.println( "" );
  }

  public void doWarnToLog( String s ) {
    pw.println( "" );
  }

  public void doShrinkLog( String s ) {
    pw.println( s );
  }

  public void close() {
    pw.println("");
    pw.println();
    pw.close();
    unregister();
  }

  public static String replaceSpecialChars( String s ) {

    StringReader reader = new StringReader( s );

    StringBuilder r = new StringBuilder();

    int i;
    try {
      while( (i = reader.read()) != -1 ) {

        char c = (char) i;

        switch( c ) {

          case '>' :
              r.append( ">" );
              break;

          case '<':
              r.append( "<" );
              break;

          default:
            r.append( c );
        }

      }
    } catch ( IOException e ) {
      Logger.err( e.getMessage() );
    }
    return r.toString();
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy