|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jdt.internal.compiler.util.Util
public class Util
Nested Class Summary | |
---|---|
static interface |
Util.Displayable
|
Field Summary | |
---|---|
static char |
C_ARRAY
Character constant indicating an array type in a signature. |
static char |
C_BOOLEAN
Character constant indicating the primitive type boolean in a signature. |
static char |
C_BYTE
Character constant indicating the primitive type byte in a signature. |
static char |
C_CAPTURE
Character constant indicating a capture of a wildcard type in a signature. |
static char |
C_CHAR
Character constant indicating the primitive type char in a signature. |
static char |
C_COLON
Character constant indicating the colon in a signature. |
static char |
C_DOLLAR
Character constant indicating the dollar in a signature. |
static char |
C_DOT
Character constant indicating the dot in a signature. |
static char |
C_DOUBLE
Character constant indicating the primitive type double in a signature. |
static char |
C_EXCEPTION_START
Character constant indicating an exception in a signature. |
static char |
C_EXTENDS
Character constant indicating a bound wildcard type argument in a signature with extends clause. |
static char |
C_FLOAT
Character constant indicating the primitive type float in a signature. |
static char |
C_GENERIC_END
Character constant indicating the end of a generic type list in a signature. |
static char |
C_GENERIC_START
Character constant indicating the start of a formal type parameter (or type argument) list in a signature. |
static char |
C_INT
Character constant indicating the primitive type int in a signature. |
static char |
C_LONG
Character constant indicating the primitive type long in a signature. |
static char |
C_NAME_END
Character constant indicating the end of a named type in a signature. |
static char |
C_PARAM_END
Character constant indicating the end of a parameter type list in a signature. |
static char |
C_PARAM_START
Character constant indicating the start of a parameter type list in a signature. |
static char |
C_RESOLVED
Character constant indicating the start of a resolved, named type in a signature. |
static char |
C_SEMICOLON
Character constant indicating the semicolon in a signature. |
static char |
C_SHORT
Character constant indicating the primitive type short in a signature. |
static char |
C_STAR
Character constant indicating an unbound wildcard type argument in a signature. |
static char |
C_SUPER
Character constant indicating a bound wildcard type argument in a signature with super clause. |
static char |
C_TYPE_VARIABLE
Character constant indicating the start of a resolved type variable in a signature. |
static char |
C_UNRESOLVED
Character constant indicating the start of an unresolved, named type in a signature. |
static char |
C_VOID
Character constant indicating result type void in a signature. |
static int[] |
EMPTY_INT_ARRAY
|
static String |
EMPTY_STRING
|
static String |
LINE_SEPARATOR
|
static String |
UTF_8
|
Fields inherited from interface org.eclipse.jdt.internal.compiler.util.SuffixConstants |
---|
EXTENSION_class, EXTENSION_CLASS, EXTENSION_java, EXTENSION_JAVA, SUFFIX_class, SUFFIX_CLASS, SUFFIX_java, SUFFIX_JAVA, SUFFIX_STRING_class, SUFFIX_STRING_CLASS, SUFFIX_STRING_java, SUFFIX_STRING_JAVA |
Constructor Summary | |
---|---|
Util()
|
Method Summary | |
---|---|
static String |
buildAllDirectoriesInto(String outputPath,
String relativeFileName)
Build all the directories and subdirectories corresponding to the packages names into the directory specified in parameters. |
static char[] |
bytesToChar(byte[] bytes,
String encoding)
Returns the given bytes as a char array using a given encoding (null means platform default). |
static void |
collectRunningVMBootclasspath(List bootclasspaths)
|
static int |
computeOuterMostVisibility(TypeDeclaration typeDeclaration,
int visibility)
Returns the outer most enclosing type's visibility for the given TypeDeclaration and visibility based on compiler options. |
static String |
getExceptionSummary(Throwable exception)
Returns a one line summary for an exception (extracted from its stacktrace: name + first frame) |
static byte[] |
getFileByteContent(File file)
Returns the contents of the given file as a byte array. |
static char[] |
getFileCharContent(File file,
String encoding)
Returns the contents of the given file as a char array. |
static byte[] |
getInputStreamAsByteArray(InputStream stream,
int length)
Returns the given input stream's contents as a byte array. |
static char[] |
getInputStreamAsCharArray(InputStream stream,
int length,
String encoding)
Returns the given input stream's contents as a character array. |
static File |
getJavaHome()
|
static int |
getLineNumber(int position,
int[] lineEnds,
int g,
int d)
|
static int |
getParameterCount(char[] methodSignature)
|
static byte[] |
getZipEntryByteContent(ZipEntry ze,
ZipFile zip)
Returns the contents of the given zip entry as a byte array. |
static int |
hashCode(Object[] array)
|
static boolean |
isClassFileName(char[] name)
Returns true iff str.toLowerCase().endsWith(".class") implementation is not creating extra strings. |
static boolean |
isClassFileName(String name)
Returns true iff str.toLowerCase().endsWith(".class") implementation is not creating extra strings. |
static boolean |
isExcluded(char[] path,
char[][] inclusionPatterns,
char[][] exclusionPatterns,
boolean isFolderPath)
|
static boolean |
isJavaFileName(char[] name)
Returns true iff str.toLowerCase().endsWith(".java") implementation is not creating extra strings. |
static boolean |
isJavaFileName(String name)
Returns true iff str.toLowerCase().endsWith(".java") implementation is not creating extra strings. |
static boolean |
isPotentialZipArchive(String name)
Returns whether the given name is potentially a zip archive file name (it has a file extension and it is not ".java" nor ".class") |
static void |
recordNestedType(ClassFile classFile,
TypeBinding typeBinding)
|
static void |
reverseQuickSort(char[][] list,
int left,
int right)
|
static void |
reverseQuickSort(char[][] list,
int left,
int right,
int[] result)
|
static int |
scanArrayTypeSignature(char[] string,
int start)
Scans the given string for an array type signature starting at the given index and returns the index of the last character. |
static int |
scanBaseTypeSignature(char[] string,
int start)
Scans the given string for a base type signature starting at the given index and returns the index of the last character. |
static int |
scanCaptureTypeSignature(char[] string,
int start)
Scans the given string for a capture of a wildcard type signature starting at the given index and returns the index of the last character. |
static int |
scanClassTypeSignature(char[] string,
int start)
Scans the given string for a class type signature starting at the given index and returns the index of the last character. |
static int |
scanIdentifier(char[] string,
int start)
Scans the given string for an identifier starting at the given index and returns the index of the last character. |
static int |
scanTypeArgumentSignature(char[] string,
int start)
Scans the given string for a type argument signature starting at the given index and returns the index of the last character. |
static int |
scanTypeArgumentSignatures(char[] string,
int start)
Scans the given string for a list of type argument signatures starting at the given index and returns the index of the last character. |
static int |
scanTypeBoundSignature(char[] string,
int start)
Scans the given string for a type bound signature starting at the given index and returns the index of the last character. |
static int |
scanTypeSignature(char[] string,
int start)
Scans the given string for a type signature starting at the given index and returns the index of the last character. |
static int |
scanTypeVariableSignature(char[] string,
int start)
Scans the given string for a type variable signature starting at the given index and returns the index of the last character. |
static int |
searchColumnNumber(int[] startLineIndexes,
int lineNumber,
int position)
INTERNAL USE-ONLY Search the column number corresponding to a specific position |
static Boolean |
toBoolean(boolean bool)
Converts a boolean value into Boolean. |
static String |
toString(Object[] objects)
Converts an array of Objects into String. |
static String |
toString(Object[] objects,
Util.Displayable renderer)
Converts an array of Objects into String. |
static void |
writeToDisk(boolean generatePackagesStructure,
String outputPath,
String relativeFileName,
ClassFile classFile)
outputPath is formed like: c:\temp\ the last character is a file separator relativeFileName is formed like: java\lang\String.class |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final char C_BOOLEAN
'Z'
.
public static final char C_BYTE
'B'
.
public static final char C_CHAR
'C'
.
public static final char C_DOUBLE
'D'
.
public static final char C_FLOAT
'F'
.
public static final char C_INT
'I'
.
public static final char C_SEMICOLON
';'
.
public static final char C_COLON
':'
.
public static final char C_LONG
'J'
.
public static final char C_SHORT
'S'
.
public static final char C_VOID
'V'
.
public static final char C_TYPE_VARIABLE
'T'
.
public static final char C_STAR
'*'
.
public static final char C_EXCEPTION_START
'^'
.
public static final char C_EXTENDS
'+'
.
public static final char C_SUPER
'-'
.
public static final char C_DOT
'.'
.
public static final char C_DOLLAR
'$'
.
public static final char C_ARRAY
'['
.
public static final char C_RESOLVED
'L'
.
public static final char C_UNRESOLVED
'Q'
.
public static final char C_NAME_END
';'
.
public static final char C_PARAM_START
'('
.
public static final char C_PARAM_END
')'
.
public static final char C_GENERIC_START
'<'
.
public static final char C_GENERIC_END
'>'
.
public static final char C_CAPTURE
'!'
.
public static final String UTF_8
public static final String LINE_SEPARATOR
public static final String EMPTY_STRING
public static final int[] EMPTY_INT_ARRAY
Constructor Detail |
---|
public Util()
Method Detail |
---|
public static String buildAllDirectoriesInto(String outputPath, String relativeFileName) throws IOException
outputPath
- java.lang.StringrelativeFileName
- java.lang.String
IOException
public static char[] bytesToChar(byte[] bytes, String encoding) throws IOException
IOException
public static int computeOuterMostVisibility(TypeDeclaration typeDeclaration, int visibility)
public static byte[] getFileByteContent(File file) throws IOException
IOException
- if a problem occured reading the file.public static char[] getFileCharContent(File file, String encoding) throws IOException
IOException
- if a problem occured reading the file.public static byte[] getInputStreamAsByteArray(InputStream stream, int length) throws IOException
IOException
- if a problem occured reading the stream.public static char[] getInputStreamAsCharArray(InputStream stream, int length, String encoding) throws IOException
IOException
- if a problem occured reading the stream.public static String getExceptionSummary(Throwable exception)
exception
-
public static int getLineNumber(int position, int[] lineEnds, int g, int d)
public static byte[] getZipEntryByteContent(ZipEntry ze, ZipFile zip) throws IOException
IOException
- if a problem occured reading the zip entry.public static int hashCode(Object[] array)
public static final boolean isPotentialZipArchive(String name)
public static final boolean isClassFileName(char[] name)
public static final boolean isClassFileName(String name)
public static final boolean isExcluded(char[] path, char[][] inclusionPatterns, char[][] exclusionPatterns, boolean isFolderPath)
public static final boolean isJavaFileName(char[] name)
public static final boolean isJavaFileName(String name)
public static void reverseQuickSort(char[][] list, int left, int right)
public static void reverseQuickSort(char[][] list, int left, int right, int[] result)
public static final int searchColumnNumber(int[] startLineIndexes, int lineNumber, int position)
public static Boolean toBoolean(boolean bool)
bool
- The boolean to convert
public static String toString(Object[] objects)
public static String toString(Object[] objects, Util.Displayable renderer)
public static void writeToDisk(boolean generatePackagesStructure, String outputPath, String relativeFileName, ClassFile classFile) throws IOException
generatePackagesStructure
- a flag to know if the packages structure has to be generated.outputPath
- the given output directoryrelativeFileName
- the given relative file nameclassFile
- the given classFile to write
IOException
public static void recordNestedType(ClassFile classFile, TypeBinding typeBinding)
public static File getJavaHome()
public static void collectRunningVMBootclasspath(List bootclasspaths)
public static int getParameterCount(char[] methodSignature)
public static int scanTypeSignature(char[] string, int start)
TypeSignature: | BaseTypeSignature | ArrayTypeSignature | ClassTypeSignature | TypeVariableSignature
string
- the signature stringstart
- the 0-based character index of the first character
IllegalArgumentException
- if this is not a type signaturepublic static int scanBaseTypeSignature(char[] string, int start)
BaseTypeSignature: B | C | D | F | I | J | S | V | ZNote that although the base type "V" is only allowed in method return types, there is no syntactic ambiguity. This method will accept them anywhere without complaint.
string
- the signature stringstart
- the 0-based character index of the first character
IllegalArgumentException
- if this is not a base type signaturepublic static int scanArrayTypeSignature(char[] string, int start)
ArrayTypeSignature: [ TypeSignature
string
- the signature stringstart
- the 0-based character index of the first character
IllegalArgumentException
- if this is not an array type signaturepublic static int scanCaptureTypeSignature(char[] string, int start)
CaptureTypeSignature: ! TypeBoundSignature
string
- the signature stringstart
- the 0-based character index of the first character
IllegalArgumentException
- if this is not a capture type signaturepublic static int scanTypeVariableSignature(char[] string, int start)
TypeVariableSignature: T Identifier ;
string
- the signature stringstart
- the 0-based character index of the first character
IllegalArgumentException
- if this is not a type variable signaturepublic static int scanIdentifier(char[] string, int start)
string
- the signature stringstart
- the 0-based character index of the first character
IllegalArgumentException
- if this is not an identifierpublic static int scanClassTypeSignature(char[] string, int start)
ClassTypeSignature: { L | Q } Identifier { { / | . Identifier [ < TypeArgumentSignature* > ] } ;Note that although all "/"-identifiers most come before "."-identifiers, there is no syntactic ambiguity. This method will accept them without complaint.
string
- the signature stringstart
- the 0-based character index of the first character
IllegalArgumentException
- if this is not a class type signaturepublic static int scanTypeBoundSignature(char[] string, int start)
TypeBoundSignature: [-+] TypeSignature ; *
string
- the signature stringstart
- the 0-based character index of the first character
IllegalArgumentException
- if this is not a type variable signaturepublic static int scanTypeArgumentSignatures(char[] string, int start)
TypeArgumentSignatures: < TypeArgumentSignature* >Note that although there is supposed to be at least one type argument, there is no syntactic ambiguity if there are none. This method will accept zero type argument signatures without complaint.
string
- the signature stringstart
- the 0-based character index of the first character
IllegalArgumentException
- if this is not a list of type arguments
signaturespublic static int scanTypeArgumentSignature(char[] string, int start)
TypeArgumentSignature: * | + TypeSignature | - TypeSignature | TypeSignatureNote that although base types are not allowed in type arguments, there is no syntactic ambiguity. This method will accept them without complaint.
string
- the signature stringstart
- the 0-based character index of the first character
IllegalArgumentException
- if this is not a type argument signature
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |