RSE
Release 3.2

org.eclipse.rse.services.clientserver.java
Class ClassFileUtil

java.lang.Object
  extended by org.eclipse.rse.services.clientserver.java.ClassFileUtil

public class ClassFileUtil
extends Object

Singleton class for obtaining various information about class files.


Method Summary
static ClassFileUtil getInstance()
          Returns the singleton instance.
 String getQualifiedClassName(File classFile)
          Gets the qualified class name.
 String getQualifiedClassName(InputStream stream)
          Gets the qualified class name for the class represented by the given input stream.
 String getQualifiedClassName(String classFilePath)
          Gets the qualified class name for the file with the given path.
 boolean isRunnable(File classFile)
          Returns whether the class is runnable, i.e. whether it contains public static void main (String[]) method.
 boolean isRunnable(InputStream stream)
          Returns whether the class represented by the given input stream is runnable, i.e. whether it contains public static void main (String[]) method.
 boolean isRunnable(String classFilePath)
          Returns whether the class with the given path is runnable, i.e. whether it contains public static void main (String[]) method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static final ClassFileUtil getInstance()
Returns the singleton instance.

Returns:
the singleton instance.

isRunnable

public boolean isRunnable(String classFilePath)
                   throws IOException
Returns whether the class with the given path is runnable, i.e. whether it contains public static void main (String[]) method.

Parameters:
classFilePath - the class file path.
Returns:
true if the class file is runnable, false otherwise.
Throws:
IOException - if an I/O error occurs.

isRunnable

public boolean isRunnable(File classFile)
                   throws IOException
Returns whether the class is runnable, i.e. whether it contains public static void main (String[]) method.

Parameters:
classFile - the class file.
Returns:
true if the class file is runnable, false otherwise.
Throws:
IOException - if an I/O error occurs.

isRunnable

public boolean isRunnable(InputStream stream)
                   throws IOException
Returns whether the class represented by the given input stream is runnable, i.e. whether it contains public static void main (String[]) method.

Parameters:
stream - the input stream.
Returns:
true if the class file is runnable, false otherwise.
Throws:
IOException - if an I/O error occurs.

getQualifiedClassName

public String getQualifiedClassName(String classFilePath)
                             throws IOException
Gets the qualified class name for the file with the given path.

Parameters:
classFilePath - the class file path.
Throws:
IOException - if an I/O error occurs.

getQualifiedClassName

public String getQualifiedClassName(File classFile)
                             throws IOException
Gets the qualified class name.

Parameters:
classFile - the class file.
Throws:
IOException - if an I/O error occurs.

getQualifiedClassName

public String getQualifiedClassName(InputStream stream)
                             throws IOException
Gets the qualified class name for the class represented by the given input stream.

Parameters:
stream - the input stream representing a class.
Throws:
IOException - if an I/O error occurs.

RSE
Release 3.2

Copyright (c) IBM Corporation and others 2000, 2010. All Rights Reserved.