emma

    }
    if (pos + length > max) {
      length = max - pos;
    }
    if (length <= 0) {
      return 0;
    }
    byte[] mbuf = m_buf;
    if (length < 9) {
      for (int i = 0; i < length; i++) {
        buf[(offset + i)] = mbuf[(pos + i)];
      }
    } else {
      System.arraycopy(mbuf, pos, buf, offset, length);
    }
    m_pos += length;
    
    return length;
  }
  
  public final int available()
  {
    return m_max - m_pos;
  }
  
  public final long skip(long n)
  {
    if (m_pos + n > m_max) {
      n = m_max - m_pos;
    }
    if (n < 0L) {
      return 0L;
    }
    m_pos = ((int)(m_pos + n));
    
    return n;
  }
  
  public final void reset()
  {
    m_pos = 0;
  }
  
  public final void close()
  {
    reset();
  }
}

/* Location:
 * Qualified Name:     com.vladium.util.ByteArrayIStream
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.util;

import java.io.IOException;
import java.io.OutputStream;

public final class ByteArrayOStream
  extends OutputStream
{
  private byte[] m_buf;
  private int m_pos;
  private static final int NATIVE_COPY_THRESHOLD = 9;
  
  public ByteArrayOStream(int initialCapacity)
  {
    m_buf = new byte[initialCapacity];
  }
  
  public final ByteArrayIStream toByteIStream()
  {
    return new ByteArrayIStream(m_buf, m_pos);
  }
  
  public final void write2(int b1, int b2)
  {
    int pos = m_pos;
    int capacity = pos + 2;
    byte[] mbuf = m_buf;
    int mbuflen = mbuf.length;
    if (mbuflen < capacity)
    {
      byte[] newbuf = new byte[Math.max(mbuflen << 1, capacity)];
      if (pos < 9) {
        for (int i = 0; i < pos; i++) {
          newbuf[i] = mbuf[i];
        }
      } else {
        System.arraycopy(mbuf, 0, newbuf, 0, pos);
      }
      m_buf = (mbuf = newbuf);
    }
    mbuf[pos] = ((byte)b1);
    mbuf[(pos + 1)] = ((byte)b2);
    m_pos = capacity;
  }
  
  public final void write3(int b1, int b2, int b3)
  {
    int pos = m_pos;
    int capacity = pos + 3;
    byte[] mbuf = m_buf;
    int mbuflen = mbuf.length;
    if (mbuflen < capacity)
    {
      byte[] newbuf = new byte[Math.max(mbuflen << 1, capacity)];
      if (pos < 9) {
        for (int i = 0; i < pos; i++) {
          newbuf[i] = mbuf[i];
        }
      } else {
        System.arraycopy(mbuf, 0, newbuf, 0, pos);
      }
      m_buf = (mbuf = newbuf);
    }
    mbuf[pos] = ((byte)b1);
    mbuf[(pos + 1)] = ((byte)b2);
    mbuf[(pos + 2)] = ((byte)b3);
    m_pos = capacity;
  }
  
  public final void write4(int b1, int b2, int b3, int b4)
  {
    int pos = m_pos;
    int capacity = pos + 4;
    byte[] mbuf = m_buf;
    int mbuflen = mbuf.length;
    if (mbuflen < capacity)
    {
      byte[] newbuf = new byte[Math.max(mbuflen << 1, capacity)];
      if (pos < 9) {
        for (int i = 0; i < pos; i++) {
          newbuf[i] = mbuf[i];
        }
      } else {
        System.arraycopy(mbuf, 0, newbuf, 0, pos);
      }
      m_buf = (mbuf = newbuf);
    }
    mbuf[pos] = ((byte)b1);
    mbuf[(pos + 1)] = ((byte)b2);
    mbuf[(pos + 2)] = ((byte)b3);
    mbuf[(pos + 3)] = ((byte)b4);
    m_pos = capacity;
  }
  
  public final void writeTo(OutputStream out)
    throws IOException
  {
    out.write(m_buf, 0, m_pos);
  }
  
  public final byte[] getByteArray()
  {
    return m_buf;
  }
  
  public final byte[] copyByteArray()
  {
    int pos = m_pos;
    
    byte[] result = new byte[pos];
    byte[] mbuf = m_buf;
    if (pos < 9) {
      for (int i = 0; i < pos; i++) {
        result[i] = mbuf[i];
      }
    } else {
      System.arraycopy(mbuf, 0, result, 0, pos);
    }
    return result;
  }
  
  public final int size()
  {
    return m_pos;
  }
  
  public final int capacity()
  {
    return m_buf.length;
  }
  
  public final void reset()
  {
    m_pos = 0;
  }
  
  public final void write(int b)
  {
    int pos = m_pos;
    int capacity = pos + 1;
    byte[] mbuf = m_buf;
    int mbuflen = mbuf.length;
    if (mbuflen < capacity)
    {
      byte[] newbuf = new byte[Math.max(mbuflen << 1, capacity)];
      if (pos < 9) {
        for (int i = 0; i < pos; i++) {
          newbuf[i] = mbuf[i];
        }
      } else {
        System.arraycopy(mbuf, 0, newbuf, 0, pos);
      }
      m_buf = (mbuf = newbuf);
    }
    mbuf[pos] = ((byte)b);
    m_pos = capacity;
  }
  
  public final void write(byte[] buf, int offset, int length)
  {
    int pos = m_pos;
    int capacity = pos + length;
    byte[] mbuf = m_buf;
    int mbuflen = mbuf.length;
    if (mbuflen < capacity)
    {
      byte[] newbuf = new byte[Math.max(mbuflen << 1, capacity)];
      if (pos < 9) {
        for (int i = 0; i < pos; i++) {
          newbuf[i] = mbuf[i];
        }
      } else {
        System.arraycopy(mbuf, 0, newbuf, 0, pos);
      }
      m_buf = (mbuf = newbuf);
    }
    if (length < 9) {
      for (int i = 0; i < length; i++) {
        mbuf[(pos + i)] = buf[(offset + i)];
      }
    } else {
      System.arraycopy(buf, offset, mbuf, pos, length);
    }
    m_pos = capacity;
  }
  
  public final void close()
  {
    reset();
  }
}

/* Location:
 * Qualified Name:     com.vladium.util.ByteArrayOStream
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.util;

public class ClassLoadContext
{
  private final Class m_caller;
  
  public final Class getCallerClass()
  {
    return m_caller;
  }
  
  ClassLoadContext(Class caller)
  {
    m_caller = caller;
  }
}

/* Location:
 * Qualified Name:     com.vladium.util.ClassLoadContext
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.util;

class ClassLoaderResolver$1 {}

/* Location:
 * Qualified Name:     com.vladium.util.ClassLoaderResolver.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.util;

final class ClassLoaderResolver$CallerResolver
  extends SecurityManager
{
  ClassLoaderResolver$CallerResolver(ClassLoaderResolver.1 x0)
  {
    this();
  }
  
  protected Class[] getClassContext()
  {
    return super.getClassContext();
  }
  
  private ClassLoaderResolver$CallerResolver() {}
}

/* Location:
 * Qualified Name:     com.vladium.util.ClassLoaderResolver.CallerResolver
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.util;

final class ClassLoaderResolver$DefaultClassLoadStrategy
  implements IClassLoadStrategy
{
  ClassLoaderResolver$DefaultClassLoadStrategy(ClassLoaderResolver.1 x0)
  {
    this();
  }
  
  public ClassLoader getClassLoader(ClassLoadContext ctx)
  {
    if (ctx == null) {
      throw new IllegalArgumentException("null input: ctx");
    }
    Class caller = ctx.getCallerClass();
    ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
    ClassLoader result;
    ClassLoader result;
    if (caller == null)
    {
      result = contextLoader;
    }
    else
    {
      ClassLoader callerLoader = caller.getClassLoader();
      ClassLoader result;
      if (ClassLoaderResolver.isChild(callerLoader, contextLoader)) {
        result = contextLoader;
      } else {
        result = callerLoader;
      }
    }
    ClassLoader systemLoader = ClassLoader.getSystemClassLoader();
    if (ClassLoaderResolver.isChild(result, systemLoader)) {
      result = systemLoader;
    }
    return result;
  }
  
  private ClassLoaderResolver$DefaultClassLoadStrategy() {}
}

/* Location:
 * Qualified Name:     com.vladium.util.ClassLoaderResolver.DefaultClassLoadStrategy
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.util;

public abstract class ClassLoaderResolver
{
  public static synchronized ClassLoader getClassLoader(Class caller)
  {
    ClassLoadContext ctx = new ClassLoadContext(caller);
    
    return s_strategy.getClassLoader(ctx);
  }
  
  public static synchronized ClassLoader getClassLoader()
  {
    Class caller = getCallerClass(1);
    ClassLoadContext ctx = new ClassLoadContext(caller);
    
    return s_strategy.getClassLoader(ctx);
  }
  
  public static Class getCallerClass(int callerOffset)
  {
    if (CALLER_RESOLVER == null) {
      return null;
    }
    return CALLER_RESOLVER.getClassContext()[(2 + callerOffset)];
  }
  
  public static boolean isChild(ClassLoader loader1, ClassLoader loader2)
  {
    if (loader1 == loader2) {
      return true;
    }
    if (loader2 == null) {
      return false;
    }
    if (loader1 == null) {
      return true;
    }
    for (; loader2 != null; loader2 = loader2.getParent()) {
      if (loader2 == loader1) {
        return true;
      }
    }
    return false;
  }
  
  public static synchronized IClassLoadStrategy getStrategy()
  {
    return s_strategy;
  }
  
  public static synchronized IClassLoadStrategy setStrategy(IClassLoadStrategy strategy)
  {
    if (strategy == null) {
      throw new IllegalArgumentException("null input: strategy");
    }
    IClassLoadStrategy old = s_strategy;
    s_strategy = strategy;
    
    return old;
  }
  
  private static final class DefaultClassLoadStrategy
    implements IClassLoadStrategy
  {
    DefaultClassLoadStrategy(ClassLoaderResolver.1 x0)
    {
      this();
    }
    
    public ClassLoader getClassLoader(ClassLoadContext ctx)
    {
      if (ctx == null) {
        throw new IllegalArgumentException("null input: ctx");
      }
      Class caller = ctx.getCallerClass();
      ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
      ClassLoader result;
      ClassLoader result;
      if (caller == null)
      {
        result = contextLoader;
      }
      else
      {
        ClassLoader callerLoader = caller.getClassLoader();
        ClassLoader result;
        if (ClassLoaderResolver.isChild(callerLoader, contextLoader)) {
          result = contextLoader;
        } else {
          result = callerLoader;
        }
      }
      ClassLoader systemLoader = ClassLoader.getSystemClassLoader();
      if (ClassLoaderResolver.isChild(result, systemLoader)) {
        result = systemLoader;
      }
      return result;
    }
    
    private DefaultClassLoadStrategy() {}
  }
  
  private static final class CallerResolver
    extends SecurityManager
  {
    CallerResolver(ClassLoaderResolver.1 x0)
    {
      this();
    }
    
    protected Class[] getClassContext()
    {
      return super.getClassContext();
    }
    
    private CallerResolver() {}
  }
  
  static
  {
    CallerResolver temp = null;
    try
    {
      temp = new CallerResolver(null);
    }
    catch (Throwable t) {}
    CALLER_RESOLVER = temp;
  }
  
  private static IClassLoadStrategy s_strategy = new DefaultClassLoadStrategy(null);
  private static final int CALL_CONTEXT_OFFSET = 2;
  private static final CallerResolver CALLER_RESOLVER;
}

/* Location:
 * Qualified Name:     com.vladium.util.ClassLoaderResolver
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.util;

public abstract class Descriptors
{
  public static final char JAVA_NAME_SEPARATOR = '.';
  public static final char VM_NAME_SEPARATOR = '/';
  private static final boolean RENAME_INNER_CLASSES = false;
  
  public static String combine(String packageName, String name, char separator)
  {
    if ((name == null) || (name.length() == 0)) {
      throw new IllegalArgumentException("null or empty input: name");
    }
    if ((packageName == null) || (packageName.length() == 0)) {
      return name;
    }
    return packageName + separator + name;
  }
  
  public static String combineJavaName(String packageName, String name)
  {
    return combine(packageName, name, '.');
  }
  
  public static String combineVMName(String packageName, String name)
  {
    return combine(packageName, name, '/');
  }
  
  public static String javaNameToVMName(String javaName)
  {
    if (javaName == null) {
      return null;
    }
    return javaName.replace('.', '/');
  }
  
  public static String vmNameToJavaName(String vmName)
  {
    if (vmName == null) {
      return null;
    }
    return vmName.replace('/', '.');
  }
  
  public static String methodVMNameToJavaName(String className, String methodVMName, String descriptor, boolean renameInits, boolean shortTypeNames, boolean appendReturnType)
  {
    StringBuffer out = new StringBuffer();
    if (renameInits)
    {
      if ("<clinit>".equals(methodVMName)) {
        return "<static initializer>";
      }
      if ("<init>".equals(methodVMName)) {
        out.append(className);
      } else {
        out.append(methodVMName);
      }
    }
    else
    {
      if ("<clinit>".equals(methodVMName)) {
        return "<clinit>";
      }
      out.append(methodVMName);
    }
    char[] chars = descriptor.toCharArray();
    
    out.append(" (");
    for (int end = chars.length; chars[(--end)] != ')';) {}
    for (int start = 1; start < end;)
    {
      if (start > 1) {
        out.append(", ");
      }
      start = typeDescriptorToJavaName(chars, start, shortTypeNames, out);
    }
    if (appendReturnType)
    {
      out.append("): ");
      
      typeDescriptorToJavaName(chars, end + 1, shortTypeNames, out);
    }
    else
    {
      out.append(')');
    }
    return out.toString();
  }
  
  private static int typeDescriptorToJavaName(char[] descriptor, int start, boolean shortTypeNames, StringBuffer out)
  {
    for (int dims = 0; descriptor[start] == '['; start++) {
      dims++;
    }
    char c = descriptor[(start++)];
    switch (c)
    {
    case 'L': 
      if (shortTypeNames)
      {
        int lastSlash = -1;
        for (int s = start; descriptor[s] != ';'; s++) {
          if (descriptor[s] == '/') {
            lastSlash = s;
          }
        }
        for (start = lastSlash > 0 ? lastSlash + 1 : start; descriptor[start] != ';'; start++)
        {
          c = descriptor[start];
          
          out.append(c);
        }
      }
      else
      {
        for (; descriptor[start] != ';'; start++)
        {
          c = descriptor[start];
          out.append(c != '/' ? c : '.');
        }
      }
      start++;
      
      break;
    case 'B': 
      out.append("byte"); break;
    case 'C': 
      out.append("char"); break;
    case 'D': 
      out.append("double"); break;
    case 'F': 
      out.append("float"); break;
    case 'I': 
      out.append("int"); break;
    case 'J': 
      out.append("long"); break;
    case 'S': 
      out.append("short"); break;
    case 'Z': 
      out.append("boolean"); break;
    case 'V': 
      out.append("void"); break;
    case 'E': 
    case 'G': 
    case 'H': 
    case 'K': 
    case 'M': 
    case 'N': 
    case 'O': 
    case 'P': 
    case 'Q': 
    case 'R': 
    case 'T': 
    case 'U': 
    case 'W': 
    case 'X': 
    case 'Y': 
    default: 
      throw new IllegalStateException("unknown type descriptor element: " + c);
    }
    if (dims > 0)
    {
      out.append(' ');
      for (int d = 0; d < dims; d++) {
        out.append("[]");
      }
    }
    return start;
  }
}

/* Location:
 * Qualified Name:     com.vladium.util.Descriptors
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.util;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;

public abstract class Files
{
  public static String[] readFileList(File atfile)
    throws IOException
  {
    if (atfile == null) {
      throw new IllegalArgumentException("null input: atfile");
    }
    List _result = null;
    
    BufferedReader in = null;
    try
    {
      in = new BufferedReader(new FileReader(atfile), 8192);
      _result = new LinkedList();
      String line;
      while ((line = in.readLine()) != null)
      {
        line = line.trim();
        if ((line.length() != 0) && (line.charAt(0) != '#')) {
          _result.add(line);
        }
      }
    }
    finally
    {
      if (in != null) {
        try
        {
          in.close();
        }
        catch (Exception ignore) {}
      }
    }
    if ((_result == null) || (_result.isEmpty())) {
      return IConstants.EMPTY_STRING_ARRAY;
    }
    String[] result = new String[_result.size()];
    _result.toArray(result);
    
    return result;
  }
  
  public static File[] pathToFiles(String[] path, boolean canonical)
  {
    if (path == null) {
      throw new IllegalArgumentException("null input: path");
    }
    if (path.length == 0) {
      return IConstants.EMPTY_FILE_ARRAY;
    }
    List _result = new ArrayList(path.length);
    Set pathnames = new HashSet(path.length);
    
    String separators = ",".concat(File.pathSeparator);
    for (int i = 0; i < path.length; i++)
    {
      String segment = path[i];
      if (segment == null) {
        throw new IllegalArgumentException("null input: path[" + i + "]");
      }
      StringTokenizer tokenizer = new StringTokenizer(segment, separators);
      while (tokenizer.hasMoreTokens())
      {
        String pathname = tokenizer.nextToken();
        if (canonical) {
          pathname = canonicalizePathname(pathname);
        }
        if (pathnames.add(pathname)) {
          _result.add(new File(pathname));
        }
      }
    }
    File[] result = new File[_result.size()];
    _result.toArray(result);
    
    return result;
  }
  
  public static String canonicalizePathname(String pathname)
  {
    if (pathname == null) {
      throw new IllegalArgumentException("null input: pathname");
    }
    try
    {
      return new File(pathname).getCanonicalPath();
    }
    catch (Exception e) {}
    return new File(pathname).getAbsolutePath();
  }
  
  public static File canonicalizeFile(File file)
  {
    if (file == null) {
      throw new IllegalArgumentException("null input: file");
    }
    try
    {
      return file.getCanonicalFile();
    }
    catch (Exception e) {}
    return file.getAbsoluteFile();
  }
  
  public static String getFileName(File file)
  {
    if (file == null) {
      throw new IllegalArgumentException("null input: file");
    }
    String name = file.getName();
    int lastDot = name.lastIndexOf('.');
    if (lastDot < 0) {
      return name;
    }
    return name.substring(0, lastDot);
  }
  
  public static String getFileExtension(File file)
  {
    if (file == null) {
      throw new IllegalArgumentException("null input: file");
    }
    String name = file.getName();
    int lastDot = name.lastIndexOf('.');
    if (lastDot < 0) {
      return "";
    }
    return name.substring(lastDot);
  }
  
  public static File newFile(File dir, File file)
  {
    if (file == null) {
      throw new IllegalArgumentException("null input: file");
    }
    if ((dir == null) || (file.isAbsolute())) {
      return file;
    }
    return new File(dir, file.getPath());
  }
  
  public static File newFile(File dir, String file)
  {
    if (file == null) {
      throw new IllegalArgumentException("null input: file");
    }
    File fileFile = new File(file);
    if ((dir == null) || (fileFile.isAbsolute())) {
      return fileFile;
    }
    return new File(dir, file);
  }
  
  public static File newFile(String dir, String file)
  {
    if (file == null) {
      throw new IllegalArgumentException("null input: file");
    }
    File fileFile = new File(file);
    if ((dir == null) || (fileFile.isAbsolute())) {
      return fileFile;
    }
    return new File(dir, file);
  }
  
  public static boolean renameFile(File source, File target, boolean overwrite)
  {
    if ((source == null) || (!source.exists())) {
      throw new IllegalArgumentException("invalid input source: [" + source + "]");
    }
    if (target == null) {
      throw new IllegalArgumentException("null input: target");
    }
    boolean targetExists;
    if ((!(targetExists = target.exists())) || (overwrite))
    {
      if (targetExists)
      {
        target.delete();
      }
      else
      {
        File targetDir = target.getParentFile();
        if ((targetDir != null) && (!targetDir.equals(source.getParentFile()))) {
          targetDir.mkdirs();
        }
      }
      return source.renameTo(target);
    }
    return false;
  }
  
  public static File createTempFile(File parentDir, String prefix, String extension)
    throws IOException
  {
    if ((parentDir == null) || (!parentDir.exists())) {
      throw new IllegalArgumentException("invalid parent directory: [" + parentDir + "]");
    }
    if ((prefix == null) || (prefix.length() < 3)) {
      throw new IllegalArgumentException("null or less than 3 chars long: " + prefix);
    }
    if (extension == null) {
      extension = ".tmp";
    } else if (extension.charAt(0) != '.') {
      extension = ".".concat(extension);
    }
    return File.createTempFile(prefix, extension, parentDir);
  }
}

/* Location:
 * Qualified Name:     com.vladium.util.Files
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.util;

public abstract interface IClassLoadStrategy
{
  public abstract ClassLoader getClassLoader(ClassLoadContext paramClassLoadContext);
}

/* Location:
 * Qualified Name:     com.vladium.util.IClassLoadStrategy
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.util;

import java.io.File;

public abstract interface IConstants
{
  public static final String[] EMPTY_STRING_ARRAY = new String[0];
  public static final File[] EMPTY_FILE_ARRAY = new File[0];
  public static final int[] EMPTY_INT_ARRAY = new int[0];
  public static final String EOL = System.getProperty("line.separator", "\n");
  public static final String INDENT_INCREMENT = "  ";
}

/* Location:
 * Qualified Name:     com.vladium.util.IConstants
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.util;

class IJREVersion$1
{
  static Class class$java$lang$SecurityManager;
  
  static Class class$(String x0)
  {
    try
    {
      return Class.forName(x0);
    }
    catch (ClassNotFoundException x1)
    {
      throw new NoClassDefFoundError(x1.getMessage());
    }
  }
}

/* Location:
 * Qualified Name:     com.vladium.util.IJREVersion.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.util;

public abstract class IJREVersion$_JREVersion
{
  static final boolean _JRE_1_2_PLUS = ((IJREVersion.1.class$java$lang$SecurityManager == null ? (IJREVersion.1.class$java$lang$SecurityManager = IJREVersion.1.class$("java.lang.SecurityManager")) : IJREVersion.1.class$java$lang$SecurityManager).getModifiers() & 0x400) == 0;
  static final boolean _JRE_1_3_PLUS;
  static final boolean _JRE_1_4_PLUS;
  static final boolean _JRE_SUN_SIGNAL_COMPATIBLE;
  
  static
  {
    boolean temp = false;
    if (_JRE_1_2_PLUS) {
      try
      {
        StrictMath.abs(1.0D);
        temp = true;
      }
      catch (Error ignore) {}
    }
    _JRE_1_3_PLUS = temp;
    if (temp)
    {
      temp = false;
      try
      {
        " ".subSequence(0, 0);
        temp = true;
      }
      catch (NoSuchMethodError ignore) {}
    }
    _JRE_1_4_PLUS = temp;
    
    temp = false;
    try
    {
      Class.forName("sun.misc.Signal");
      Class.forName("sun.misc.SignalHandler");
      
      temp = true;
    }
    catch (Throwable ignore) {}
    _JRE_SUN_SIGNAL_COMPATIBLE = temp;
  }
}

/* Location:
 * Qualified Name:     com.vladium.util.IJREVersion._JREVersion
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.util;

public abstract interface IJREVersion
{
  public static final boolean JRE_1_2_PLUS = _JREVersion._JRE_1_2_PLUS;
  public static final boolean JRE_1_3_PLUS = _JREVersion._JRE_1_3_PLUS;
  public static final boolean JRE_1_4_PLUS = _JREVersion._JRE_1_4_PLUS;
  public static final boolean JRE_SUN_SIGNAL_COMPATIBLE = _JREVersion._JRE_SUN_SIGNAL_COMPATIBLE;
  
  public static abstract class _JREVersion
  {
    static final boolean _JRE_1_2_PLUS = ((IJREVersion.1.class$java$lang$SecurityManager == null ? (IJREVersion.1.class$java$lang$SecurityManager = IJREVersion.1.class$("java.lang.SecurityManager")) : IJREVersion.1.class$java$lang$SecurityManager).getModifiers() & 0x400) == 0;
    static final boolean _JRE_1_3_PLUS;
    static final boolean _JRE_1_4_PLUS;
    static final boolean _JRE_SUN_SIGNAL_COMPATIBLE;
    
    static
    {
      boolean temp = false;
      if (_JRE_1_2_PLUS) {
        try
        {
          StrictMath.abs(1.0D);
          temp = true;
        }
        catch (Error ignore) {}
      }
      _JRE_1_3_PLUS = temp;
      if (temp)
      {
        temp = false;
        try
        {
          " ".subSequence(0, 0);
          temp = true;
        }
        catch (NoSuchMethodError ignore) {}
      }
      _JRE_1_4_PLUS = temp;
      
      temp = false;
      try
      {
        Class.forName("sun.misc.Signal");
        Class.forName("sun.misc.SignalHandler");
        
        temp = true;
      }
      catch (Throwable ignore) {}
      _JRE_SUN_SIGNAL_COMPATIBLE = temp;
    }
  }
}

/* Location:
 * Qualified Name:     com.vladium.util.IJREVersion
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.util;

import com.vladium.logging.Logger;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.jar.Attributes;
import java.util.jar.Attributes.Name;
import java.util.jar.JarFile;
import java.util.jar.JarInputStream;
import java.util.jar.Manifest;
import java.util.zip.ZipEntry;

final class IPathEnumerator$Factory$PathEnumerator
  implements IPathEnumerator
{
  private final ArrayList m_path;
  private final boolean m_canonical;
  private final Set m_pathSet;
  private final IPathEnumerator.IPathHandler m_handler;
  private final boolean m_processManifest;
  private final Logger m_log;
  private boolean m_verbose;
  private boolean m_trace1;
  private int m_pathIndex;
  private File m_currentPathDir;
  private static final boolean IGNORE_INVALID_ENTRIES = true;
  
  public void enumerate()
    throws IOException
  {
    IPathEnumerator.IPathHandler handler = m_handler;
    for (m_pathIndex = 0; m_pathIndex < m_path.size(); m_pathIndex += 1)
    {
      File f = (File)m_path.get(m_pathIndex);
      if (f.exists()) {
        if (f.isDirectory())
        {
          if (m_verbose) {
            m_log.verbose("processing dir path entry [" + f.getAbsolutePath() + "] ...");
          }
          m_currentPathDir = f;
          enumeratePathDir(null);
        }
        else
        {
          String name = f.getName();
          String lcName = name.toLowerCase();
          if ((lcName.endsWith(".zip")) || (lcName.endsWith(".jar")))
          {
            if (m_verbose) {
              m_log.verbose("processing archive path entry [" + f.getAbsolutePath() + "] ...");
            }
            File parent = f.getParentFile();
            File archive = new File(name);
            m_currentPathDir = parent;
            
            enumeratePathArchive(name);
            handler.handleArchiveEnd(parent, archive);
          }
        }
      }
    }
  }
  
  IPathEnumerator$Factory$PathEnumerator(File[] path, boolean canonical, IPathEnumerator.IPathHandler handler)
  {
    m_path = new ArrayList(path.length);
    for (int p = 0; p < path.length; p++) {
      m_path.add(path[p]);
    }
    m_canonical = canonical;
    if (handler == null) {
      throw new IllegalArgumentException("null input: handler");
    }
    m_handler = handler;
    
    m_processManifest = true;
    if (m_processManifest)
    {
      m_pathSet = new HashSet(path.length);
      for (int p = 0; p < path.length; p++) {
        m_pathSet.add(path[p].getPath());
      }
    }
    else
    {
      m_pathSet = null;
    }
    m_log = Logger.getLogger();
    m_verbose = m_log.atVERBOSE();
    m_trace1 = m_log.atTRACE1();
  }
  
  private void enumeratePathDir(String dir)
    throws IOException
  {
    boolean trace1 = m_trace1;
    
    File currentPathDir = m_currentPathDir;
    File fullDir = dir != null ? new File(currentPathDir, dir) : currentPathDir;
    
    String[] children = fullDir.list();
    IPathEnumerator.IPathHandler handler = m_handler;
    
    int c = 0;
    for (int cLimit = children.length; c < cLimit; c++)
    {
      String childName = children[c];
      
      File child = dir != null ? new File(dir, childName) : new File(childName);
      File fullChild = new File(fullDir, childName);
      if (fullChild.isDirectory())
      {
        handler.handleDirStart(currentPathDir, child);
        if (trace1) {
          m_log.trace1("enumeratePathDir", "recursing into [" + child.getName() + "] ...");
        }
        enumeratePathDir(child.getPath());
        handler.handleDirEnd(currentPathDir, child);
      }
      else
      {
        if (trace1) {
          m_log.trace1("enumeratePathDir", "processing file [" + child.getName() + "] ...");
        }
        handler.handleFile(currentPathDir, child);
      }
    }
  }
  
  private void enumeratePathArchive(String archive)
    throws IOException
  {
    boolean trace1 = m_trace1;
    
    File fullArchive = new File(m_currentPathDir, archive);
    
    JarInputStream in = null;
    try
    {
      in = new JarInputStream(new BufferedInputStream(new FileInputStream(fullArchive), 32768));
      
      IPathEnumerator.IPathHandler handler = m_handler;
      
      Manifest manifest = in.getManifest();
      if (manifest == null) {
        manifest = readManifestViaJarFile(fullArchive);
      }
      handler.handleArchiveStart(m_currentPathDir, new File(archive), manifest);
      ZipEntry entry;
      while ((entry = in.getNextEntry()) != null)
      {
        if (trace1) {
          m_log.trace1("enumeratePathArchive", "processing archive entry [" + entry.getName() + "] ...");
        }
        handler.handleArchiveEntry(in, entry);
        in.closeEntry();
      }
      if (m_processManifest)
      {
        if (manifest == null) {
          manifest = in.getManifest();
        }
        if (manifest != null)
        {
          Attributes attributes = manifest.getMainAttributes();
          if (attributes != null)
          {
            String jarClassPath = attributes.getValue(Attributes.Name.CLASS_PATH);
            if (jarClassPath != null)
            {
              tokenizer = new StringTokenizer(jarClassPath);
              for (p = 1; tokenizer.hasMoreTokens();)
              {
                String relPath = tokenizer.nextToken();
                
                File archiveParent = fullArchive.getParentFile();
                File path = archiveParent != null ? new File(archiveParent, relPath) : new File(relPath);
                
                String fullPath = m_canonical ? Files.canonicalizePathname(path.getPath()) : path.getPath();
                if (m_pathSet.add(fullPath))
                {
                  if (m_verbose) {
                    m_log.verbose("  added manifest Class-Path entry [" + path + "]");
                  }
                  m_path.add(m_pathIndex + p++, path);
                }
              }
            }
          }
        }
      }
    }
    catch (FileNotFoundException fnfe) {}finally
    {
      StringTokenizer tokenizer;
      int p;
      if (in != null) {
        try
        {
          in.close();
        }
        catch (Exception ignore) {}
      }
    }
  }
  
  private static Manifest readManifestViaJarFile(File archive)
  {
    Manifest result = null;
    
    JarFile jarfile = null;
    try
    {
      jarfile = new JarFile(archive, false);
      result = jarfile.getManifest();
    }
    catch (IOException ignore) {}finally
    {
      if (jarfile != null) {
        try
        {
          jarfile.close();
        }
        catch (IOException ignore) {}
      }
    }
    return result;
  }
}

/* Location:
 * Qualified Name:     com.vladium.util.IPathEnumerator.Factory.PathEnumerator
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.util;

import com.vladium.logging.Logger;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.jar.Attributes;
import java.util.jar.Attributes.Name;
import java.util.jar.JarFile;
import java.util.jar.JarInputStream;
import java.util.jar.Manifest;
import java.util.zip.ZipEntry;

public abstract class IPathEnumerator$Factory
{
  public static IPathEnumerator create(File[] path, boolean canonical, IPathEnumerator.IPathHandler handler)
  {
    return new PathEnumerator(path, canonical, handler);
  }
  
  private static final class PathEnumerator
    implements IPathEnumerator
  {
    private final ArrayList m_path;
    private final boolean m_canonical;
    private final Set m_pathSet;
    private final IPathEnumerator.IPathHandler m_handler;
    private final boolean m_processManifest;
    private final Logger m_log;
    private boolean m_verbose;
    private boolean m_trace1;
    private int m_pathIndex;
    private File m_currentPathDir;
    private static final boolean IGNORE_INVALID_ENTRIES = true;
    
    public void enumerate()
      throws IOException
    {
      IPathEnumerator.IPathHandler handler = m_handler;
      for (m_pathIndex = 0; m_pathIndex < m_path.size(); m_pathIndex += 1)
      {
        File f = (File)m_path.get(m_pathIndex);
        if (f.exists()) {
          if (f.isDirectory())
          {
            if (m_verbose) {
              m_log.verbose("processing dir path entry [" + f.getAbsolutePath() + "] ...");
            }
            m_currentPathDir = f;
            enumeratePathDir(null);
          }
          else
          {
            String name = f.getName();
            String lcName = name.toLowerCase();
            if ((lcName.endsWith(".zip")) || (lcName.endsWith(".jar")))
            {
              if (m_verbose) {
                m_log.verbose("processing archive path entry [" + f.getAbsolutePath() + "] ...");
              }
              File parent = f.getParentFile();
              File archive = new File(name);
              m_currentPathDir = parent;
              
              enumeratePathArchive(name);
              handler.handleArchiveEnd(parent, archive);
            }
          }
        }
      }
    }
    
    PathEnumerator(File[] path, boolean canonical, IPathEnumerator.IPathHandler handler)
    {
      m_path = new ArrayList(path.length);
      for (int p = 0; p < path.length; p++) {
        m_path.add(path[p]);
      }
      m_canonical = canonical;
      if (handler == null) {
        throw new IllegalArgumentException("null input: handler");
      }
      m_handler = handler;
      
      m_processManifest = true;
      if (m_processManifest)
      {
        m_pathSet = new HashSet(path.length);
        for (int p = 0; p < path.length; p++) {
          m_pathSet.add(path[p].getPath());
        }
      }
      else
      {
        m_pathSet = null;
      }
      m_log = Logger.getLogger();
      m_verbose = m_log.atVERBOSE();
      m_trace1 = m_log.atTRACE1();
    }
    
    private void enumeratePathDir(String dir)
      throws IOException
    {
      boolean trace1 = m_trace1;
      
      File currentPathDir = m_currentPathDir;
      File fullDir = dir != null ? new File(currentPathDir, dir) : currentPathDir;
      
      String[] children = fullDir.list();
      IPathEnumerator.IPathHandler handler = m_handler;
      
      int c = 0;
      for (int cLimit = children.length; c < cLimit; c++)
      {
        String childName = children[c];
        
        File child = dir != null ? new File(dir, childName) : new File(childName);
        File fullChild = new File(fullDir, childName);
        if (fullChild.isDirectory())
        {
          handler.handleDirStart(currentPathDir, child);
          if (trace1) {
            m_log.trace1("enumeratePathDir", "recursing into [" + child.getName() + "] ...");
          }
          enumeratePathDir(child.getPath());
          handler.handleDirEnd(currentPathDir, child);
        }
        else
        {
          if (trace1) {
            m_log.trace1("enumeratePathDir", "processing file [" + child.getName() + "] ...");
          }
          handler.handleFile(currentPathDir, child);
        }
      }
    }
    
    private void enumeratePathArchive(String archive)
      throws IOException
    {
      boolean trace1 = m_trace1;
      
      File fullArchive = new File(m_currentPathDir, archive);
      
      JarInputStream in = null;
      try
      {
        in = new JarInputStream(new BufferedInputStream(new FileInputStream(fullArchive), 32768));
        
        IPathEnumerator.IPathHandler handler = m_handler;
        
        Manifest manifest = in.getManifest();
        if (manifest == null) {
          manifest = readManifestViaJarFile(fullArchive);
        }
        handler.handleArchiveStart(m_currentPathDir, new File(archive), manifest);
        ZipEntry entry;
        while ((entry = in.getNextEntry()) != null)
        {
          if (trace1) {
            m_log.trace1("enumeratePathArchive", "processing archive entry [" + entry.getName() + "] ...");
          }
          handler.handleArchiveEntry(in, entry);
          in.closeEntry();
        }
        if (m_processManifest)
        {
          if (manifest == null) {
            manifest = in.getManifest();
          }
          if (manifest != null)
          {
            Attributes attributes = manifest.getMainAttributes();
            if (attributes != null)
            {
              String jarClassPath = attributes.getValue(Attributes.Name.CLASS_PATH);
              if (jarClassPath != null)
              {
                tokenizer = new StringTokenizer(jarClassPath);
                for (p = 1; tokenizer.hasMoreTokens();)
                {
                  String relPath = tokenizer.nextToken();
                  
                  File archiveParent = fullArchive.getParentFile();
                  File path = archiveParent != null ? new File(archiveParent, relPath) : new File(relPath);
                  
                  String fullPath = m_canonical ? Files.canonicalizePathname(path.getPath()) : path.getPath();
                  if (m_pathSet.add(fullPath))
                  {
                    if (m_verbose) {
                      m_log.verbose("  added manifest Class-Path entry [" + path + "]");
                    }
                    m_path.add(m_pathIndex + p++, path);
                  }
                }
              }
            }
          }
        }
      }
      catch (FileNotFoundException fnfe) {}finally
      {
        StringTokenizer tokenizer;
        int p;
        if (in != null) {
          try
          {
            in.close();
          }
          catch (Exception ignore) {}
        }
      }
    }
    
    private static Manifest readManifestViaJarFile(File archive)
    {
      Manifest result = null;
      
      JarFile jarfile = null;
      try
      {
        jarfile = new JarFile(archive, false);
        result = jarfile.getManifest();
      }
      catch (IOException ignore) {}finally
      {
        if (jarfile != null) {
          try
          {
            jarfile.close();
          }
          catch (IOException ignore) {}
        }
      }
      return result;
    }
  }
}

/* Location:
 * Qualified Name:     com.vladium.util.IPathEnumerator.Factory
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.util;

import java.io.File;
import java.util.jar.JarInputStream;
import java.util.jar.Manifest;
import java.util.zip.Zip
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22

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