htmlconverter

16:36:29.708 INFO  jd.cli.Main - Decompiling htmlconverter.jar
import java.io.File;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Enumeration;
import java.util.Vector;
import sun.plugin.converter.ResourceHandler;
import sun.plugin.converter.engine.DefaultSet;
import sun.plugin.converter.engine.PluginConverter;
import sun.plugin.converter.gui.ConverterGUI;
import sun.plugin.converter.util.CommandLine;
import sun.plugin.converter.util.CommandLineException;
import sun.plugin.converter.util.FileAccessException;
import sun.plugin.converter.util.FlexFilter;
import sun.plugin.converter.util.NotDirectoryException;

public class HTMLConverter
{
  private CommandLine cmdLine;
  private FlexFilter fileFilter = new FlexFilter();
  private PluginConverter converter = null;
  private DefaultSet set = null;
  private File logFile = null;
  private boolean stdin = false;
  private boolean stdout = false;
  private String sourceStr = null;
  private String backupStr = null;
  private String destStr = null;
  private String tempStr = null;
  private String logStr = null;
  private String sep = System.getProperty("file.separator");
  
  public HTMLConverter(String[] paramArrayOfString)
  {
    try
    {
      cmdLine = new CommandLine(paramArrayOfString);
      if (cmdLine.justHelp())
      {
        showHelp();
        System.exit(-1);
      }
      else if (cmdLine.doGUI())
      {
        processWithGUI();
      }
      else
      {
        processCommandLine();
      }
    }
    catch (CommandLineException localCommandLineException)
    {
      showHelp();
      System.exit(-1);
    }
    catch (IndexOutOfBoundsException localIndexOutOfBoundsException)
    {
      showHelp();
      System.exit(-1);
    }
    catch (NotDirectoryException localNotDirectoryException)
    {
      System.out.println(localNotDirectoryException.getMessage());
      System.exit(-1);
    }
    catch (FileAccessException localFileAccessException)
    {
      System.out.println(localFileAccessException.getMessage());
      System.exit(-1);
    }
  }
  
  private void processWithGUI()
  {
    ConverterGUI localConverterGUI = new ConverterGUI();
    
    localConverterGUI.pack();
    localConverterGUI.setVisible(true);
  }
  
  private void processCommandLine()
    throws NotDirectoryException, FileAccessException
  {
    try
    {
      converter = new PluginConverter(cmdLine.isLogFile(), cmdLine.showProgress());
      converter.setStaticVersioning(cmdLine.getStaticVersioning());
      converter.setOverwrite(cmdLine.isOverwrite());
      converter.setConvertSet(set = new DefaultSet());
      converter.setCommandLine(true);
    }
    catch (FileNotFoundException localFileNotFoundException)
    {
      System.out.println(ResourceHandler.getMessage("notemplate_dialog.info0") + PluginConverter.getDefaultTemplateFileName() + ResourceHandler.getMessage("notemplate_dialog.info1"));
      System.exit(-2);
    }
    Vector localVector;
    if (cmdLine.isStdIn())
    {
      stdin = true;
      localVector = cmdLine.getStandardInput();
      if (localVector != null) {
        for (localEnumeration = localVector.elements(); localEnumeration.hasMoreElements();) {
          fileFilter.addDescriptor((String)localEnumeration.nextElement());
        }
      }
    }
    else
    {
      localVector = cmdLine.getFileSpecs();
      for (localEnumeration = localVector.elements(); localEnumeration.hasMoreElements();) {
        fileFilter.addDescriptor((String)localEnumeration.nextElement());
      }
    }
    if (cmdLine.doSubDirs())
    {
      fileFilter.setFilesOnly(false);
      converter.setRecurse(true);
    }
    if (cmdLine.showProgress()) {
      converter.setShowProgressStdOut(true);
    }
    if (cmdLine.isStdOut()) {
      stdout = true;
    }
    setSource();
    setDest();
    setBack();
    setTemp();
    setLog();
    
    Enumeration localEnumeration = set.getFilesEnumeration();
    if ((!stdin) && (set.getFileCount() == 0))
    {
      System.out.println(ResourceHandler.getMessage("plugin_converter.nofiles"));
      System.exit(-2);
    }
    else if (cmdLine.justSimulate())
    {
      simulate(localEnumeration);
    }
    else
    {
      converter.setSourceType(stdin);
      converter.setDestType(stdout);
      converter.startConversion();
    }
  }
  
  private void showHelp()
  {
    System.out.println(ResourceHandler.getMessage("plugin_converter.help_message"));
  }
  
  public static boolean checkTrue(String paramString)
  {
    paramString = paramString.trim().toUpperCase();
    return (paramString.equals("TRUE")) || (paramString.equals("T")) || (paramString.equals("YES")) || (paramString.equals("Y"));
  }
  
  private void setSource()
    throws NotDirectoryException
  {
    sourceStr = cmdLine.getSourceDir();
    if (sourceStr != null)
    {
      File localFile = new File(sourceStr);
      set.setSourcePath(localFile, fileFilter);
    }
    else
    {
      set.setFiles(fileFilter);
    }
  }
  
  private void setDest()
  {
    destStr = cmdLine.getDestDir();
    if (destStr != null)
    {
      File localFile = new File(destStr);
      set.setDestinationPath(localFile);
    }
    set.setDestinationPath(set.getDefaultDestPath());
  }
  
  private void setBack()
  {
    backupStr = cmdLine.getBackupDir();
    if (backupStr != null)
    {
      File localFile = new File(backupStr);
      set.setBackupPath(localFile);
    }
    else if (!stdin)
    {
      set.setBackupPath(set.getDefaultBackupPath());
    }
  }
  
  private void setTemp()
  {
    tempStr = cmdLine.getTemplateDir();
    if (tempStr != null) {
      try
      {
        InputStream localInputStream = HTMLConverter.class.getClassLoader().getResourceAsStream(tempStr);
        converter.setTemplateFilePath(tempStr);
      }
      catch (FileNotFoundException localFileNotFoundException)
      {
        System.out.println(ResourceHandler.getMessage("nottemplatefile_dialog.info2") + ":  " + tempStr);
        System.exit(-2);
      }
    }
  }
  
  private void setLog()
  {
    logStr = cmdLine.getLogFile();
    if (logStr != null)
    {
      logFile = new File(logStr);
      converter.setLogFile(logFile);
    }
  }
  
  private void simulate(Enumeration paramEnumeration)
  {
    System.out.println(ResourceHandler.getMessage("plugin_converter.files"));
    while (paramEnumeration.hasMoreElements()) {
      System.out.println(set.getSourcePath() + sep + (String)paramEnumeration.nextElement());
    }
    System.out.println("\n" + ResourceHandler.getMessage("plugin_converter.backup_path") + ":\t" + set.getBackupPath());
    if (logFile != null) {
      System.out.println(ResourceHandler.getMessage("plugin_converter.log_path") + ":\t" + (cmdLine.getLogFile() == null ? converter.getDefaultLogFile().getAbsolutePath() : logFile.getAbsolutePath()));
    }
    System.out.println("\n" + ResourceHandler.getMessage("plugin_converter.template_file") + ":\t" + converter.getTemplateFilePath());
    
    System.out.println(ResourceHandler.getMessage("plugin_converter.process_subdirs") + ":\t" + converter.isRecurse());
    
    System.out.println(ResourceHandler.getMessage("plugin_converter.show_progress") + ":\t" + converter.isShowProgressStdOut());
    
    System.out.println("");
  }
  
  public static void main(String[] paramArrayOfString)
  {
    HTMLConverter localHTMLConverter = new HTMLConverter(paramArrayOfString);
  }
}

/* Location:
 * Qualified Name:     HTMLConverter
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.plugin.converter.engine;

import java.util.Enumeration;
import java.util.StringTokenizer;
import java.util.Vector;

public class AppletPieces
{
  private String _codeBase;
  private String _archive;
  private String _code;
  private String _object;
  private String _alt;
  private String _name;
  private String _width;
  private String _height;
  private String _align;
  private String _vspace;
  private String _hspace;
  private String _alternateHTML = "";
  private String _mayScript;
  private Vector params = new Vector();
  private String eolStr;
  
  public AppletPieces(String paramString)
  {
    eolStr = paramString;
  }
  
  public void setCODEBASE(String paramString)
  {
    _codeBase = paramString;
  }
  
  public String getCODEBASE()
  {
    return _codeBase;
  }
  
  public void setARCHIVE(String paramString)
  {
    _archive = paramString;
  }
  
  public String getARCHIVE()
  {
    return _archive;
  }
  
  public void setCODE(String paramString)
  {
    _code = paramString;
  }
  
  public String getCODE()
  {
    return _code;
  }
  
  public void setOBJECT(String paramString)
  {
    _object = paramString;
  }
  
  public String getOBJECT()
  {
    return _object;
  }
  
  public void setALT(String paramString)
  {
    _alt = paramString;
  }
  
  public String getALT()
  {
    return _alt;
  }
  
  public void setNAME(String paramString)
  {
    _name = paramString;
  }
  
  public String getNAME()
  {
    return _name;
  }
  
  public void setWIDTH(String paramString)
  {
    _width = paramString;
  }
  
  public String getWIDTH()
  {
    return _width;
  }
  
  public void setHEIGHT(String paramString)
  {
    _height = paramString;
  }
  
  public String getHEIGHT()
  {
    return _height;
  }
  
  public void setALIGN(String paramString)
  {
    _align = paramString;
  }
  
  public String getALIGN()
  {
    return _align;
  }
  
  public void setVSPACE(String paramString)
  {
    _vspace = paramString;
  }
  
  public String getVSPACE()
  {
    return _vspace;
  }
  
  public void setHSPACE(String paramString)
  {
    _hspace = paramString;
  }
  
  public String getHSPACE()
  {
    return _hspace;
  }
  
  public void setAlternateHTML(String paramString)
  {
    _alternateHTML = paramString;
  }
  
  public String getAlternateHTML()
  {
    return _alternateHTML;
  }
  
  public void setMAYSCRIPT(String paramString)
  {
    _mayScript = paramString;
  }
  
  public String getMAYSCRIPT()
  {
    return _mayScript;
  }
  
  private String getSeparator(boolean paramBoolean)
  {
    return paramBoolean ? eolStr : " ";
  }
  
  public String getAttributes(boolean paramBoolean)
  {
    StringBuffer localStringBuffer = new StringBuffer();
    if (_code != null) {
      localStringBuffer.append(getSeparator(paramBoolean) + _code);
    }
    if (_codeBase != null) {
      localStringBuffer.append(getSeparator(paramBoolean) + _codeBase);
    }
    if (_archive != null) {
      localStringBuffer.append(getSeparator(paramBoolean) + _archive);
    }
    if (_object != null) {
      localStringBuffer.append(getSeparator(paramBoolean) + _object);
    }
    if (_width != null) {
      localStringBuffer.append(getSeparator(paramBoolean) + _width);
    }
    if (_height != null) {
      localStringBuffer.append(getSeparator(paramBoolean) + _height);
    }
    if (_name != null) {
      localStringBuffer.append(getSeparator(paramBoolean) + _name);
    }
    if (_align != null) {
      localStringBuffer.append(getSeparator(paramBoolean) + _align);
    }
    if (_vspace != null) {
      localStringBuffer.append(getSeparator(paramBoolean) + _vspace);
    }
    if (_hspace != null) {
      localStringBuffer.append(getSeparator(paramBoolean) + _hspace);
    }
    if (_alt != null) {
      localStringBuffer.append(getSeparator(paramBoolean) + _alt);
    }
    if (_mayScript != null) {
      localStringBuffer.append(getSeparator(paramBoolean) + _mayScript);
    }
    return localStringBuffer.toString();
  }
  
  public String getObjectTagAttributes(boolean paramBoolean)
  {
    StringBuffer localStringBuffer = new StringBuffer();
    if (_width != null) {
      localStringBuffer.append(convertEscapes(_width) + getSeparator(paramBoolean));
    }
    if (_height != null) {
      localStringBuffer.append(convertEscapes(_height) + getSeparator(paramBoolean));
    }
    if (_name != null) {
      localStringBuffer.append(convertEscapes(_name) + getSeparator(paramBoolean));
    }
    if (_align != null) {
      localStringBuffer.append(convertEscapes(_align) + getSeparator(paramBoolean));
    }
    if (_vspace != null) {
      localStringBuffer.append(convertEscapes(_vspace) + getSeparator(paramBoolean));
    }
    if (_hspace != null) {
      localStringBuffer.append(convertEscapes(_hspace) + getSeparator(paramBoolean));
    }
    if (_alt != null) {
      localStringBuffer.append(convertEscapes(_alt) + getSeparator(paramBoolean));
    }
    return localStringBuffer.toString();
  }
  
  public static String convertEscapes(String paramString)
  {
    StringTokenizer localStringTokenizer = new StringTokenizer(paramString, "'", true);
    String str = "";
    StringBuffer localStringBuffer = new StringBuffer();
    while (localStringTokenizer.hasMoreTokens())
    {
      str = localStringTokenizer.nextToken();
      if (str.equals("'")) {
        localStringBuffer.append("'");
      } else {
        localStringBuffer.append(str);
      }
    }
    return localStringBuffer.toString();
  }
  
  public String getObjectTagParams(boolean paramBoolean)
  {
    StringBuffer localStringBuffer = new StringBuffer();
    String str2;
    StringTokenizer localStringTokenizer;
    String str1;
    if (_code != null)
    {
      str2 = "";
      localStringTokenizer = new StringTokenizer(_code);
      str1 = localStringTokenizer.nextToken();str1 = localStringTokenizer.nextToken();
      while (localStringTokenizer.hasMoreTokens())
      {
        if ((str1 = localStringTokenizer.nextToken()).endsWith(">")) {
          str1 = str1.substring(0, str1.length() - 2);
        }
        str2 = str2 + str1 + " ";
      }
      localStringBuffer.append("<PARAM NAME = CODE VALUE = " + str2 + ">" + eolStr);
    }
    if (_codeBase != null)
    {
      str2 = "";
      localStringTokenizer = new StringTokenizer(_codeBase);
      str1 = localStringTokenizer.nextToken();str1 = localStringTokenizer.nextToken();
      while (localStringTokenizer.hasMoreTokens())
      {
        if ((str1 = localStringTokenizer.nextToken()).endsWith(">")) {
          str1 = str1.substring(0, str1.length() - 2);
        }
        str2 = str2 + str1 + " ";
      }
      localStringBuffer.append("    <PARAM NAME = CODEBASE VALUE = " + str2 + ">" + eolStr);
    }
    if (_archive != null)
    {
      str2 = "";
      localStringTokenizer = new StringTokenizer(_archive);
      str1 = localStringTokenizer.nextToken();str1 = localStringTokenizer.nextToken();
      while (localStringTokenizer.hasMoreTokens())
      {
        if ((str1 = localStringTokenizer.nextToken()).endsWith(">")) {
          str1 = str1.substring(0, str1.length() - 2);
        }
        str2 = str2 + str1 + " ";
      }
      localStringBuffer.append("    <PARAM NAME = ARCHIVE VALUE = " + str2 + ">" + eolStr);
    }
    if (_object != null)
    {
      str2 = "";
      localStringTokenizer = new StringTokenizer(_object);
      str1 = localStringTokenizer.nextToken();str1 = localStringTokenizer.nextToken();
      while (localStringTokenizer.hasMoreTokens())
      {
        if ((str1 = localStringTokenizer.nextToken()).endsWith(">")) {
          str1 = str1.substring(0, str1.length() - 2);
        }
        str2 = str2 + str1 + " ";
      }
      localStringBuffer.append("    <PARAM NAME = OBJECT VALUE = " + str2 + ">" + eolStr);
    }
    if (_name != null)
    {
      str2 = "";
      localStringTokenizer = new StringTokenizer(_name);
      str1 = localStringTokenizer.nextToken();str1 = localStringTokenizer.nextToken();
      while (localStringTokenizer.hasMoreTokens())
      {
        if ((str1 = localStringTokenizer.nextToken()).endsWith(">")) {
          str1 = str1.substring(0, str1.length() - 2);
        }
        str2 = str2 + str1 + " ";
      }
      localStringBuffer.append("    <PARAM NAME = NAME VALUE = " + str2 + ">" + eolStr);
    }
    if (_mayScript != null)
    {
      str2 = "";
      localStringTokenizer = new StringTokenizer(_mayScript);
      str1 = localStringTokenizer.nextToken();str1 = localStringTokenizer.nextToken();
      while (localStringTokenizer.hasMoreTokens())
      {
        if ((str1 = localStringTokenizer.nextToken()).endsWith(">")) {
          str1 = str1.substring(0, str1.length() - 2);
        }
        str2 = str2 + str1 + " ";
      }
      localStringBuffer.append("    <PARAM NAME = MAYSCRIPT VALUE = " + str2 + ">" + eolStr);
    }
    return localStringBuffer.toString().trim();
  }
  
  public String getAppletText(boolean paramBoolean)
  {
    StringBuffer localStringBuffer = new StringBuffer();
    
    localStringBuffer.append("<APPLET");
    localStringBuffer.append(getAttributes(paramBoolean));
    localStringBuffer.append(">" + eolStr);
    for (int i = 0; i < params.size(); i++) {
      localStringBuffer.append((String)params.elementAt(i) + eolStr);
    }
    localStringBuffer.append(_alternateHTML + eolStr);
    
    localStringBuffer.append(eolStr + "</APPLET>");
    
    return localStringBuffer.toString();
  }
  
  public void addParam(String paramString)
  {
    params.addElement(paramString);
  }
  
  public Enumeration getParamEnumeration()
  {
    return params.elements();
  }
  
  public String getEmbedTagAttributes()
  {
    StringBuffer localStringBuffer = new StringBuffer();
    
    String str1 = "            ";
    String str2 = "\n";
    String str3 = " \\";
    if (_code != null) {
      localStringBuffer.append(str3 + str2 + str1 + convertEscapes(_code));
    }
    if (_codeBase != null)
    {
      _codeBase = ("JAVA_" + _codeBase);
      localStringBuffer.append(str3 + str2 + str1 + convertEscapes(_codeBase));
    }
    if (_archive != null) {
      localStringBuffer.append(str3 + str2 + str1 + convertEscapes(_archive));
    }
    if (_object != null) {
      localStringBuffer.append(str3 + str2 + str1 + convertEscapes(_object));
    }
    if (_alt != null) {
      localStringBuffer.append(str3 + str2 + str1 + convertEscapes(_alt));
    }
    if (_name != null) {
      localStringBuffer.append(str3 + str2 + str1 + convertEscapes(_name));
    }
    if (_width != null) {
      localStringBuffer.append(str3 + str2 + str1 + convertEscapes(_width));
    }
    if (_height != null) {
      localStringBuffer.append(str3 + str2 + str1 + convertEscapes(_height));
    }
    if (_align != null) {
      localStringBuffer.append(str3 + str2 + str1 + convertEscapes(_align));
    }
    if (_vspace != null) {
      localStringBuffer.append(str3 + str2 + str1 + convertEscapes(_vspace));
    }
    if (_hspace != null) {
      localStringBuffer.append(str3 + str2 + str1 + convertEscapes(_hspace));
    }
    if (_mayScript != null) {
      localStringBuffer.append(str3 + str2 + str1 + convertEscapes(_mayScript));
    }
    return localStringBuffer.toString();
  }
  
  public String toString()
  {
    String str = "\nCODEBASE: " + _codeBase + "\nARCHIVE: " + _archive + "\nCODE: " + _code + "\nOBJECT: " + _object + "\nALT: " + _alt + "\nNAME: " + _name + "\nWIDTH: " + _width + "\nHEIGHT: " + _height + "\nALIGN: " + _align + "\nVSPACE: " + _vspace + "\nHSPACE: " + _hspace + "\nMAYSCRIPT: " + _mayScript;
    
    str = str + "\nParams:";
    Enumeration localEnumeration = getParamEnumeration();
    while (localEnumeration.hasMoreElements()) {
      str = str + "\n" + (String)localEnumeration.nextElement();
    }
    str = str + "\nAlternate HTML:";
    str = str + "\n" + _alternateHTML;
    
    return str;
  }
}

/* Location:
 * Qualified Name:     sun.plugin.converter.engine.AppletPieces
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.plugin.converter.engine;

import java.io.File;
import java.io.FileNotFoundException;

public abstract interface Converter
{
  public abstract void setShowProgressStdOut(boolean paramBoolean);
  
  public abstract boolean isShowProgressStdOut();
  
  public abstract void setTemplateFilePath(String paramString)
    throws FileNotFoundException;
  
  public abstract String getTemplateFilePath();
  
  public abstract void setRecurse(boolean paramBoolean);
  
  public abstract boolean isRecurse();
  
  public abstract void setLogFile(File paramFile);
  
  public abstract File getLogFile();
  
  public abstract void setCreateLog(boolean paramBoolean);
  
  public abstract boolean isCreateLog();
  
  public abstract void addConverterProgressListener(ConverterProgressListener paramConverterProgressListener);
  
  public abstract void removedConverterProgressListener(ConverterProgressListener paramConverterProgressListener);
}

/* Location:
 * Qualified Name:     sun.plugin.converter.engine.Converter
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.plugin.converter.engine;

import java.util.EventObject;
import sun.plugin.converter.ResourceHandler;

public class ConverterProgressEvent
  extends EventObject
{
  public static final int PREPARING = -10;
  public static final int CONVERTING = -11;
  public static final int COPYING = -12;
  public static final int DONE = -13;
  public static final int ALL_DONE = -14;
  public static final int DEST_DIR_NOT_CREATED = -15;
  public static final int ERROR = -16;
  private String sourcePath = "";
  private String destinationPath = "";
  private String backupPath = "";
  private String currentFile = "";
  private int status;
  private int filesProcessed = 0;
  private int appletsFound = 0;
  private int errorsFound = 0;
  
  public ConverterProgressEvent(Object paramObject)
  {
    super(paramObject);
    setStatus(-10);
  }
  
  public ConverterProgressEvent(Object paramObject, String paramString1, String paramString2, String paramString3, int paramInt1, int paramInt2, int paramInt3, int paramInt4)
  {
    super(paramObject);
    currentFile = paramString3;
    status = paramInt1;
    filesProcessed = paramInt2;
    appletsFound = paramInt3;
    errorsFound = paramInt4;
    sourcePath = paramString1;
    destinationPath = paramString2;
  }
  
  public String getCurrentFile()
  {
    return currentFile;
  }
  
  public void setCurrentFile(String paramString)
  {
    currentFile = paramString;
  }
  
  public int getStatus()
  {
    return status;
  }
  
  public String getStatusText()
  {
    switch (status)
    {
    case -10: 
      return ResourceHandler.getMessage("progress_event.preparing");
    case -11: 
      return ResourceHandler.getMessage("progress_event.converting");
    case -12: 
      return ResourceHandler.getMessage("progress_event.copying");
    case -14: 
    case -13: 
      return ResourceHandler.getMessage("progress_event.done");
    case -15: 
      return ResourceHandler.getMessage("progress_event.destdirnotcreated");
    case -16: 
      return ResourceHandler.getMessage("progress_event.error");
    }
    return "";
  }
  
  public void setStatus(int paramInt)
  {
    if ((paramInt == -11) || (paramInt == -13) || (paramInt == -12) || (paramInt == -14) || (paramInt == -15) || (paramInt == -16)) {
      status = paramInt;
    } else {
      status = -10;
    }
  }
  
  public int getFilesProcessed()
  {
    return filesProcessed;
  }
  
  public void setFilesProcessed(int paramInt)
  {
    if (paramInt >= 0) {
      filesProcessed = paramInt;
    }
  }
  
  public int getAppletsFound()
  {
    return appletsFound;
  }
  
  public void setAppletsFound(int paramInt)
  {
    if (paramInt >= 0) {
      appletsFound = paramInt;
    }
  }
  
  public int getErrorsFound()
  {
    return errorsFound;
  }
  
  public void setErrorsFound(int paramInt)
  {
    if (paramInt >= 0) {
      errorsFound = paramInt;
    }
  }
  
  public String getSourcePath()
  {
    return sourcePath;
  }
  
  public void setSourcePath(String paramString)
  {
    sourcePath = paramString;
  }
  
  public String getDestinationPath()
  {
    return destinationPath;
  }
  
  public void setDestinationPath(String paramString)
  {
    destinationPath = paramString;
  }
  
  public String getBackupPath()
  {
    return backupPath;
  }
  
  public void setBackupPath(String paramString)
  {
    backupPath = paramString;
  }
  
  public String toString()
  {
    String str = "[ConverterProgressEvent";
    str = str + sourcePath;
    str = str + destinationPath;
    str = str + backupPath;
    str = str + currentFile;
    str = str + status;
    str = str + filesProcessed;
    str = str + appletsFound;
    str = str + errorsFound + "]";
    
    return str;
  }
}

/* Location:
 * Qualified Name:     sun.plugin.converter.engine.ConverterProgressEvent
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.plugin.converter.engine;

import java.util.EventListener;

public abstract interface ConverterProgressListener
  extends EventListener
{
  public abstract void converterProgressUpdate(ConverterProgressEvent paramConverterProgressEvent);
}

/* Location:
 * Qualified Name:     sun.plugin.converter.engine.ConverterProgressListener
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.plugin.converter.engine;

import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintStream;
import java.io.StreamTokenizer;
import java.util.Enumeration;
import java.util.StringTokenizer;
import sun.plugin.converter.util.StdUtils;

public class ConvertFile
{
  private byte[] templateBuffer;
  private File source;
  private File destination;
  private int appletsFound = 0;
  private int errors = 0;
  private int token;
  private String upperWord;
  private String eolStr;
  private String inEncoding = null;
  private String outEncoding = null;
  private ParsingState pState = new ParsingState();
  private String cabFileLocation = null;
  private String nsFileLocation = null;
  private String smartUpdateLocation = null;
  private String mimeType = null;
  private String classId = null;
  private boolean stdout = false;
  private static final String PARAMTAG = "APPLETPARAMS";
  private static final String EMBEDPARAMTAG = "EMBEDPARAMS";
  private static final String ALTERNATEHTMLTAG = "ALTERNATEHTML";
  private static final String APPLETATTRSTAG = "APPLETATTRIBUTES";
  private static final String OBJECTPARAMSTAG = "OBJECTPARAMS";
  private static final String OBJECTATTRIBUTES = "OBJECTATTRIBUTES";
  private static final String APPLETTEXTTAG = "ORIGINALAPPLET";
  private static final String EMBEDATTRIBUTESTAG = "EMBEDATTRIBUTES";
  private static final String CABFILELOCATIONTAG = "CABFILELOCATION";
  private static final String NSFILELOCATIONTAG = "NSFILELOCATION";
  private static final String SMARTUPDATETAG = "SMARTUPDATE";
  private static final String MIMETYPETAG = "MIMETYPE";
  private static final String CLASSID = "CLASSID";
  private static final String conversionTagBegin = "<!--\"CONVERTED_APPLET\"-->";
  private static final String conversionTagEnd = "<!--\"END_CONVERTED_APPLET\"-->";
  
  public ConvertFile(InputStream paramInputStream)
    throws IOException
  {
    ByteArrayOutputStream localByteArrayOutputStream = new ByteArrayOutputStream();
    byte[] arrayOfByte = new byte['?'];
    int i = 0;
    while ((i = paramInputStream.read(arrayOfByte, 0, 2048)) != -1) {
      localByteArrayOutputStream.write(arrayOfByte, 0, i);
    }
    templateBuffer = localByteArrayOutputStream.toByteArray();
  }
  
  public void setSource(File paramFile)
  {
    source = paramFile;
  }
  
  public File getSource()
  {
    return source;
  }
  
  public void setDestination(File paramFile)
  {
    destination = paramFile;
  }
  
  public File getDestination()
  {
    return destination;
  }
  
  public String getCabFileLocation()
  {
    return cabFileLocation;
  }
  
  public void setCabFileLocation(String paramString)
  {
    cabFileLocation = paramString;
  }
  
  public String getNSFileLocation()
  {
    return nsFileLocation;
  }
  
  public void setNSFileLocation(String paramString)
  {
    nsFileLocation = paramString;
  }
  
  public String getSmartUpdateLocation()
  {
    return smartUpdateLocation;
  }
  
  public void setSmartUpdateLocation(String paramString)
  {
    smartUpdateLocation = paramString;
  }
  
  public String getMimeType()
  {
    return mimeType;
  }
  
  public void setMimeType(String paramString)
  {
    mimeType = paramString;
  }
  
  public String getClassId()
  {
    return classId;
  }
  
  public void setClassId(String paramString)
  {
    classId = paramString;
  }
  
  public int getAppletsFound()
  {
    return appletsFound;
  }
  
  public int getErrors()
  {
    return errors;
  }
  
  public void setEncoding(String paramString)
  {
    outEncoding = (inEncoding = paramString);
  }
  
  public void setStandardOutput(boolean paramBoolean)
  {
    stdout = paramBoolean;
  }
  
  public String getEncoding()
  {
    return inEncoding;
  }
  
  public String parseCharset(String paramString)
  {
    int i = paramString.indexOf("charset");
    if (i < 0) {
      return null;
    }
    String str = paramString.substring(i);
    StringTokenizer localStringTokenizer = new StringTokenizer(str, " =\t\n\r");
    localStringTokenizer.nextToken();
    return localStringTokenizer.nextToken();
  }
  
  public void guessEncoding()
  {
    int i = 0;
    try
    {
      InputStreamReader localInputStreamReader = new InputStreamReader(new BufferedInputStream(new FileInputStream(source)));
      StreamTokenizer localStreamTokenizer = new StreamTokenizer(localInputStreamReader);
      localStreamTokenizer.wordChars(60, 62);
      localStreamTokenizer.whitespaceChars(61, 61);
      localStreamTokenizer.lowerCaseMode(true);
      for (;;)
      {
        int j = localStreamTokenizer.nextToken();
        switch (j)
        {
        case -3: 
          if (sval.equals("</head>")) {
            return;
          }
          switch (i)
          {
          case 0: 
            if (sval.equals("<head>")) {
              i = 1;
            }
            break;
          case 1: 
            if (sval.equals("content"))
            {
              localStreamTokenizer.nextToken();
              setEncoding(parseCharset(sval)); return;
            }
            break;
          }
          break;
        case -1: 
          return;
        }
      }
      return;
    }
    catch (Exception localException)
    {
      System.err.println("Something bad happened: " + localException);
    }
  }
  
  public boolean convert()
    throws Exception
  {
    eolStr = StdUtils.getEOLs(new FileInputStream(source), getEncoding());
    if ((inEncoding == null) && (outEncoding == null)) {
      guessEncoding();
    }
    BufferedWriter localBufferedWriter;
    if (stdout)
    {
      if (outEncoding == null) {
        localBufferedWriter = new BufferedWriter(new FileWriter(FileDescriptor.out));
      } else {
        localBufferedWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(FileDescriptor.out), outEncoding));
      }
    }
    else if (outEncoding == null) {
      localBufferedWriter = new BufferedWriter(new FileWriter(destination));
    } else {
      localBufferedWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(destination), outEncoding));
    }
    BufferedReader localBufferedReader;
    if (inEncoding == null) {
      localBufferedReader = new BufferedReader(new FileReader(source));
    } else {
      localBufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(source), inEncoding));
    }
    StreamTokenizer localStreamTokenizer = new StreamTokenizer(localBufferedReader);
    
    setTagSearch(localStreamTokenizer);
    while ((token = localStreamTokenizer.nextToken()) != -1) {
      if (token == -3)
      {
        upperWord = sval.toUpperCase().trim();
        if (pState.isPotentialTag())
        {
          if (upperWord.equals(pState.getTarget()))
          {
            AppletPieces localAppletPieces;
            if ((localAppletPieces = getAppletPieces(localStreamTokenizer)) != null) {
              appletsFound += 1;
            }
            String str = convertToOBJECT(localAppletPieces);
            localBufferedWriter.write("<!--\"CONVERTED_APPLET\"-->" + eolStr);
            localBufferedWriter.write(str);
            localBufferedWriter.write("<!--\"END_CONVERTED_APPLET\"-->" + eolStr);
            
            setTagSearch(localStreamTokenizer);
            if (((token = localStreamTokenizer.nextToken()) != -1) && 
              ((char)token != pState.getPotentialTagChar())) {
              continue;
            }
          }
          else if (upperWord.equals("!--"))
          {
            int i = 0;
            localBufferedWriter.write(pState.getPotentialTagChar() + "!--");
            
            setCommentScan(localStreamTokenizer);
            while ((token = localStreamTokenizer.nextToken()) != -1) {
              if (token == -3)
              {
                upperWord = sval.toUpperCase().trim();
                localBufferedWriter.write(sval);
                if ((upperWord.indexOf("-->") >= 0) && (i == 0)) {
                  break;
                }
              }
              else if (token == 34)
              {
                upperWord = sval.toUpperCase().trim();
                if (upperWord.equals("CONVERTED_APPLET")) {
                  i = 1;
                }
                if (upperWord.equals("END_CONVERTED_APPLET")) {
                  i = 0;
                }
                localBufferedWriter.write("\"" + sval + "\"");
              }
              else
              {
                localBufferedWriter.write(String.valueOf((char)token));
              }
            }
            setTagSearch(localStreamTokenizer);
          }
          else if (pState.isPotentialTag())
          {
            localBufferedWriter.write(pState.getPotentialTagChar() + sval);
          }
          else
          {
            localBufferedWriter.write(sval);
          }
        }
        else if (pState.isPotentialTag()) {
          localBufferedWriter.write(pState.getPotentialTagChar() + sval);
        } else {
          localBufferedWriter.write(sval);
        }
        pState.clearPotentialTag();
      }
      else if ((char)token == pState.getPotentialTagChar())
      {
        pState.setPotentialTag();
      }
      else
      {
        if (pState.isPotentialTag()) {
          localBufferedWriter.write(pState.getPotentialTagChar() + String.valueOf((char)token));
        } else {
          localBufferedWriter.write(String.valueOf((char)token));
        }
        pState.clearPotentialTag();
      }
    }
    localBufferedReader.close();
    localBufferedWriter.flush();
    localBufferedWriter.close();
    if (appletsFound > 0) {
      return true;
    }
    return false;
  }
  
  private void setCommentScan(StreamTokenizer paramStreamTokenizer)
  {
    paramStreamTokenizer.resetSyntax();
    
    paramStreamTokenizer.wordChars(45, 45);
    paramStreamTokenizer.wordChars(62, 62);
    paramStreamTokenizer.quoteChar(34);
    pState.setCommentState();
  }
  
  private void setTagSearch(StreamTokenizer paramStreamTokenizer)
  {
    paramStreamTokenizer.resetSyntax();
    
    paramStreamTokenizer.wordChars(65, 65);
    paramStreamTokenizer.wordChars(97, 97);
    paramStreamTokenizer.wordChars(80, 80);
    paramStreamTokenizer.wordChars(112, 112);
    paramStreamTokenizer.wordChars(76, 76);
    paramStreamTokenizer.wordChars(108, 108);
    paramStreamTokenizer.wordChars(69, 69);
    paramStreamTokenizer.wordChars(101, 101);
    paramStreamTokenizer.wordChars(84, 84);
    paramStreamTokenizer.wordChars(116, 116);
    paramStreamTokenizer.wordChars(45, 45);
    paramStreamTokenizer.wordChars(33, 33);
    
    pState.setScanState();
  }
  
  private void setAppletScan(StreamTokenizer paramStreamTokenizer)
  {
    paramStreamTokenizer.resetSyntax();
    
    paramStreamTokenizer.wordChars(33, 255);
    paramStreamTokenizer.whitespaceChars(0, 32);
    paramStreamTokenizer.whitespaceChars(0, 32);
    paramStreamTokenizer.ordinaryChar(62);
    paramStreamTokenizer.ordinaryChar(61);
    paramStreamTokenizer.quoteChar(34);
    
    pState.setAppletScanState();
  }
  
  private void setParamOrEndScan(StreamTokenizer paramStreamTokenizer)
  {
    paramStreamTokenizer.resetSyntax();
    
    paramStreamTokenizer.wordChars(65, 65);
    paramStreamTokenizer.wordChars(97, 97);
    paramStreamTokenizer.wordChars(80, 80);
    paramStreamTokenizer.wordChars(112, 112);
    paramStreamTokenizer.wordChars(76, 76);
    paramStreamTokenizer.wordChars(108, 108);
    paramStreamTokenizer.wordChars(69, 69);
    paramStreamTokenizer.wordChars(101, 101);
    paramStreamTokenizer.wordChars(84, 84);
    paramStreamTokenizer.wordChars(116, 116);
    paramStreamTokenizer.wordChars(82, 82);
    paramStreamTokenizer.wordChars(114, 114);
    paramStreamTokenizer.wordChars(77, 77);
    paramStreamTokenizer.wordChars(109, 109);
    paramStreamTokenizer.wordChars(47, 47);
    
    pState.setAltOrEndScanState();
  }
  
  private void setParamScan(StreamTokenizer paramStreamTokenizer)
  {
    paramStreamTokenizer.resetSyntax();
    
    paramStreamTokenizer.wordChars(33, 255);
    paramStreamTokenizer.whitespaceChars(0, 32);
    paramStreamTokenizer.ordinaryChar(62);
    paramStreamTokenizer.whitespaceChars(61, 61);
    paramStreamTokenizer.quoteChar(34);
    
    pState.setParamScanState();
  }
  
  public void getAppletPortion(StreamTokenizer paramStreamTokenizer, AppletPieces paramAppletPieces)
    throws Exception
  {
    setAppletScan(paramStreamTokenizer);
    while ((token = paramStreamTokenizer.nextToken()) != -1) {
      if (token == -3)
      {
        upperWord = sval.toUpperCase().trim();
        if (upperWord.equals("CODEBASE")) {
          paramAppletPieces.setCODEBASE("CODEBASE = " + getAttributeValue(pState, paramStreamTokenizer));
        } else if (upperWord.equals("ARCHIVE")) {
          paramAppletPieces.setARCHIVE("ARCHIVE = " + getAttributeValue(pState, paramStreamTokenizer));
        } else if (upperWord.equals("CODE")) {
          paramAppletPieces.setCODE("CODE = " + getAttributeValue(pState, paramStreamTokenizer));
        } else if (upperWord.equals("OBJECT")) {
          paramAppletPieces.setOBJECT("OBJECT = " + getAttributeValue(pState, paramStreamTokenizer));
        } else if (upperWord.equals("ALT")) {
          paramAppletPieces.setALT("ALT = " + getAttributeValue(pState, paramStreamTokenizer));
        } else if (upperWord.equals("NAME")) {
          paramAppletPieces.setNAME("NAME = " + getAttributeValue(pState, paramStreamTokenizer));
        } else if (upperWord.equals("WIDTH")) {
          paramAppletPieces.setWIDTH("WIDTH = " + getAttributeValue(pState, paramStreamTokenizer));
        } else if (upperWord.equals("HEIGHT")) {
          paramAppletPieces.setHEIGHT("HEIGHT = " + getAttributeValue(pState, paramStreamTokenizer));
        } else if (upperWord.equals("ALIGN")) {
          paramAppletPieces.setALIGN("ALIGN = " + getAttributeValue(pState, paramStreamTokenizer));
        } else if (upperWord.equals("VSPACE")) {
          paramAppletPieces.setVSPACE("VSPACE = " + getAttributeValue(pState, paramStreamTokenizer));
        } else if (upperWord.equals("HSPACE")) {
          paramAppletPieces.setHSPACE("HSPACE = " + getAttributeValue(pState, paramStreamTokenizer));
        } else if (upperWord.equals("MAYSCRIPT")) {
          paramAppletPieces.setMAYSCRIPT("MAYSCRIPT = " + getAttributeValueForMAYSCRIPT(pState, paramStreamTokenizer));
        }
        if (!pState.isStateClear()) {
          break;
        }
      }
      else if ((char)token == '>')
      {
        pState.clearScanState();
        return;
      }
1 2 3 4 5 6 7 8

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd