Klasse Util
java.lang.Object
org.aspectj.org.eclipse.jdt.internal.compiler.util.Util
- Alle implementierten Schnittstellen:
SuffixConstants
-
Verschachtelte Klassen - Übersicht
-
Feldübersicht
Modifizierer und TypFeldBeschreibungstatic final char
Character constant indicating an array type in a signature.static final char
Character constant indicating the primitive type boolean in a signature.static final char
Character constant indicating the primitive type byte in a signature.static final char
Character constant indicating a capture of a wildcard type in a signature.static final char
Character constant indicating the primitive type char in a signature.static final char
Character constant indicating the colon in a signature.static final char
Character constant indicating the dollar in a signature.static final char
Character constant indicating the dot in a signature.static final char
Character constant indicating the primitive type double in a signature.static final char
Character constant indicating an exception in a signature.static final char
Character constant indicating a bound wildcard type argument in a signature with extends clause.static final char
Character constant indicating the primitive type float in a signature.static final char
Character constant indicating the end of a generic type list in a signature.static final char
Character constant indicating the start of a formal type parameter (or type argument) list in a signature.static final char
Character constant indicating the primitive type int in a signature.static final char
Character constant indicating the primitive type long in a signature.static final char
Character constant indicating the end of a named type in a signature.static final char
Character constant indicating the end of a parameter type list in a signature.static final char
Character constant indicating the start of a parameter type list in a signature.static final char
Character constant indicating the start of a resolved, named type in a signature.static final char
Character constant indicating the semicolon in a signature.static final char
Character constant indicating the primitive type short in a signature.static final char
Character constant indicating an unbound wildcard type argument in a signature.static final char
Character constant indicating a bound wildcard type argument in a signature with super clause.static final char
Character constant indicating the start of a resolved type variable in a signature.static final char
Character constant indicating the start of an unresolved, named type in a signature.static final char
Character constant indicating result type void in a signature.static final String
static final int[]
static final String
static final int
static final String
static final String
static final int
Von Schnittstelle geerbte Felder org.aspectj.org.eclipse.jdt.internal.compiler.util.SuffixConstants
EXTENSION_aj, EXTENSION_AJ, EXTENSION_class, EXTENSION_CLASS, EXTENSION_java, EXTENSION_JAVA, EXTENSION_jmod, EXTENSION_JMOD, SUFFIX_aj, SUFFIX_AJ, SUFFIX_class, SUFFIX_CLASS, SUFFIX_java, SUFFIX_JAVA, SUFFIX_STRING_aj, SUFFIX_STRING_AJ, SUFFIX_STRING_class, SUFFIX_STRING_CLASS, SUFFIX_STRING_java, SUFFIX_STRING_JAVA
-
Konstruktorübersicht
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic void
appendEscapedChar
(StringBuilder buffer, char c, boolean stringLiteral) static final int
archiveFormat
(String name) Returns the kind of archive this file is.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 List
<FileSystem.Classpath> static List
<FileSystem.Classpath> collectPlatformLibraries
(File javaHome) static void
collectRunningVMBootclasspath
(List<FileSystem.Classpath> bootclasspaths) static void
collectVMBootclasspath
(List<FileSystem.Classpath> bootclasspaths, File javaHome) 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 boolean
effectivelyEqual
(Object[] one, Object[] two) 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[]
Returns the given input stream's contents as a byte array.static char[]
getInputStreamAsCharArray
(InputStream stream, String encoding) Returns the given input stream's contents as a character array.static File
static long
getJDKLevel
(File javaHome) static int
getLineNumber
(int position, int[] lineEnds, int g, int d) static int
getParameterCount
(char[] methodSignature) static CharSequence
getStackTrace
(Throwable exception) static byte[]
getZipEntryByteContent
(ZipEntry ze, ZipFile zip) Returns the contents of the given zip entry as a byte array.static int
static final boolean
isAjFileName
(String name) static final boolean
isClassFileName
(char[] name) Returns true iff str.toLowerCase().endsWith(".class") implementation is not creating extra strings.static final boolean
isClassFileName
(String name) Returns true iff str.toLowerCase().endsWith(".class") implementation is not creating extra strings.static final boolean
isExcluded
(char[] path, char[][] inclusionPatterns, char[][] exclusionPatterns, boolean isFolderPath) static final boolean
isJavaFileName
(char[] name) Returns true iff str.toLowerCase().endsWith(".java") implementation is not creating extra strings.static final boolean
isJavaFileName
(String name) Returns true iff str.toLowerCase().endsWith(".java") implementation is not creating extra strings.static final boolean
Returns true iff str.toLowerCase().endsWith("jrt-fs.jar") implementation is not creating extra strings.static final 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 byte[]
readNBytes
(InputStream input, int byteLength) Returns the given input stream's first bytes as array.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 final int
searchColumnNumber
(int[] startLineIndexes, int lineNumber, int position) INTERNAL USE-ONLY Search the column number corresponding to a specific positionstatic Boolean
toBoolean
(boolean bool) Converts a boolean value into Boolean.static String
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
-
Felddetails
-
C_BOOLEAN
public static final char C_BOOLEANCharacter constant indicating the primitive type boolean in a signature. Value is'Z'
.- Siehe auch:
-
C_BYTE
public static final char C_BYTECharacter constant indicating the primitive type byte in a signature. Value is'B'
.- Siehe auch:
-
C_CHAR
public static final char C_CHARCharacter constant indicating the primitive type char in a signature. Value is'C'
.- Siehe auch:
-
C_DOUBLE
public static final char C_DOUBLECharacter constant indicating the primitive type double in a signature. Value is'D'
.- Siehe auch:
-
C_FLOAT
public static final char C_FLOATCharacter constant indicating the primitive type float in a signature. Value is'F'
.- Siehe auch:
-
C_INT
public static final char C_INTCharacter constant indicating the primitive type int in a signature. Value is'I'
.- Siehe auch:
-
C_SEMICOLON
public static final char C_SEMICOLONCharacter constant indicating the semicolon in a signature. Value is';'
.- Siehe auch:
-
C_COLON
public static final char C_COLONCharacter constant indicating the colon in a signature. Value is':'
.- Seit:
- 3.0
- Siehe auch:
-
C_LONG
public static final char C_LONGCharacter constant indicating the primitive type long in a signature. Value is'J'
.- Siehe auch:
-
C_SHORT
public static final char C_SHORTCharacter constant indicating the primitive type short in a signature. Value is'S'
.- Siehe auch:
-
C_VOID
public static final char C_VOIDCharacter constant indicating result type void in a signature. Value is'V'
.- Siehe auch:
-
C_TYPE_VARIABLE
public static final char C_TYPE_VARIABLECharacter constant indicating the start of a resolved type variable in a signature. Value is'T'
.- Seit:
- 3.0
- Siehe auch:
-
C_STAR
public static final char C_STARCharacter constant indicating an unbound wildcard type argument in a signature. Value is'*'
.- Seit:
- 3.0
- Siehe auch:
-
C_EXCEPTION_START
public static final char C_EXCEPTION_STARTCharacter constant indicating an exception in a signature. Value is'^'
.- Seit:
- 3.1
- Siehe auch:
-
C_EXTENDS
public static final char C_EXTENDSCharacter constant indicating a bound wildcard type argument in a signature with extends clause. Value is'+'
.- Seit:
- 3.1
- Siehe auch:
-
C_SUPER
public static final char C_SUPERCharacter constant indicating a bound wildcard type argument in a signature with super clause. Value is'-'
.- Seit:
- 3.1
- Siehe auch:
-
C_DOT
public static final char C_DOTCharacter constant indicating the dot in a signature. Value is'.'
.- Siehe auch:
-
C_DOLLAR
public static final char C_DOLLARCharacter constant indicating the dollar in a signature. Value is'$'
.- Siehe auch:
-
C_ARRAY
public static final char C_ARRAYCharacter constant indicating an array type in a signature. Value is'['
.- Siehe auch:
-
C_RESOLVED
public static final char C_RESOLVEDCharacter constant indicating the start of a resolved, named type in a signature. Value is'L'
.- Siehe auch:
-
C_UNRESOLVED
public static final char C_UNRESOLVEDCharacter constant indicating the start of an unresolved, named type in a signature. Value is'Q'
.- Siehe auch:
-
C_NAME_END
public static final char C_NAME_ENDCharacter constant indicating the end of a named type in a signature. Value is';'
.- Siehe auch:
-
C_PARAM_START
public static final char C_PARAM_STARTCharacter constant indicating the start of a parameter type list in a signature. Value is'('
.- Siehe auch:
-
C_PARAM_END
public static final char C_PARAM_ENDCharacter constant indicating the end of a parameter type list in a signature. Value is')'
.- Siehe auch:
-
C_GENERIC_START
public static final char C_GENERIC_STARTCharacter constant indicating the start of a formal type parameter (or type argument) list in a signature. Value is'<'
.- Seit:
- 3.0
- Siehe auch:
-
C_GENERIC_END
public static final char C_GENERIC_ENDCharacter constant indicating the end of a generic type list in a signature. Value is'>'
.- Seit:
- 3.0
- Siehe auch:
-
C_CAPTURE
public static final char C_CAPTURECharacter constant indicating a capture of a wildcard type in a signature. Value is'!'
.- Seit:
- 3.1
- Siehe auch:
-
UTF_8
- Siehe auch:
-
LINE_SEPARATOR
-
EMPTY_STRING
-
COMMA_SEPARATOR
- Seit:
- 3.14
-
EMPTY_INT_ARRAY
public static final int[] EMPTY_INT_ARRAY -
ZIP_FILE
public static final int ZIP_FILE- Siehe auch:
-
JMOD_FILE
public static final int JMOD_FILE- Siehe auch:
-
-
Konstruktordetails
-
Util
public Util()
-
-
Methodendetails
-
buildAllDirectoriesInto
public static String buildAllDirectoriesInto(String outputPath, String relativeFileName) throws IOException Build all the directories and subdirectories corresponding to the packages names into the directory specified in parameters. outputPath is formed like: c:\temp\ the last character is a file separator relativeFileName is formed like: java\lang\String.class *- Parameter:
outputPath
- java.lang.StringrelativeFileName
- java.lang.String- Gibt zurück:
- java.lang.String
- Löst aus:
IOException
-
bytesToChar
Returns the given bytes as a char array using a given encoding (null means platform default).- Löst aus:
IOException
-
computeOuterMostVisibility
Returns the outer most enclosing type's visibility for the given TypeDeclaration and visibility based on compiler options. -
getFileByteContent
Returns the contents of the given file as a byte array.- Löst aus:
IOException
- if a problem occured reading the file.
-
getFileCharContent
Returns the contents of the given file as a char array. When encoding is null, then the platform default one is used- Löst aus:
IOException
- if a problem occured reading the file.
-
getInputStreamAsByteArray
Returns the given input stream's contents as a byte array. All bytes in the stream are returned. Note this doesn't close the stream.- Löst aus:
IOException
- if a problem occurred reading the stream.
-
readNBytes
Returns the given input stream's first bytes as array. Note this doesn't close the stream.- Löst aus:
IOException
- if a problem occurred reading the stream.
-
getInputStreamAsCharArray
public static char[] getInputStreamAsCharArray(InputStream stream, String encoding) throws IOException Returns the given input stream's contents as a character array. Note this doesn't close the stream.- Löst aus:
IOException
- if a problem occured reading the stream.
-
getExceptionSummary
Returns a one line summary for an exception (extracted from its stacktrace: name + first frame)- Gibt zurück:
- one line summary for an exception
-
getStackTrace
-
getLineNumber
public static int getLineNumber(int position, int[] lineEnds, int g, int d) -
getZipEntryByteContent
Returns the contents of the given zip entry as a byte array.- Löst aus:
IOException
- if a problem occurred reading the zip entry.
-
hashCode
-
isPotentialZipArchive
Returns whether the given name is potentially a zip archive file name (it has a file extension and it is not ".java" nor ".class") -
archiveFormat
Returns the kind of archive this file is. The format is one of #ZIP_FILE orJMOD_FILE
-
isClassFileName
public static final boolean isClassFileName(char[] name) Returns true iff str.toLowerCase().endsWith(".class") implementation is not creating extra strings. -
isClassFileName
Returns true iff str.toLowerCase().endsWith(".class") implementation is not creating extra strings. -
isExcluded
public static final boolean isExcluded(char[] path, char[][] inclusionPatterns, char[][] exclusionPatterns, boolean isFolderPath) -
isJavaFileName
public static final boolean isJavaFileName(char[] name) Returns true iff str.toLowerCase().endsWith(".java") implementation is not creating extra strings. -
isJavaFileName
Returns true iff str.toLowerCase().endsWith(".java") implementation is not creating extra strings. -
isAjFileName
-
isJrt
Returns true iff str.toLowerCase().endsWith("jrt-fs.jar") implementation is not creating extra strings. -
reverseQuickSort
public static void reverseQuickSort(char[][] list, int left, int right) -
reverseQuickSort
public static void reverseQuickSort(char[][] list, int left, int right, int[] result) -
searchColumnNumber
public static final int searchColumnNumber(int[] startLineIndexes, int lineNumber, int position) INTERNAL USE-ONLY Search the column number corresponding to a specific position -
toBoolean
Converts a boolean value into Boolean.- Parameter:
bool
- The boolean to convert- Gibt zurück:
- The corresponding Boolean object (TRUE or FALSE).
-
toString
Converts an array of Objects into String. -
toString
Converts an array of Objects into String. -
writeToDisk
public static void writeToDisk(boolean generatePackagesStructure, String outputPath, String relativeFileName, ClassFile classFile) throws IOException outputPath is formed like: c:\temp\ the last character is a file separator relativeFileName is formed like: java\lang\String.class- Parameter:
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- Löst aus:
IOException
-
recordNestedType
-
getJavaHome
-
collectVMBootclasspath
-
collectRunningVMBootclasspath
-
getJDKLevel
-
collectFilesNames
-
collectPlatformLibraries
-
getParameterCount
public static int getParameterCount(char[] methodSignature) -
scanTypeSignature
public 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.TypeSignature: | BaseTypeSignature | ArrayTypeSignature | ClassTypeSignature | TypeVariableSignature
- Parameter:
string
- the signature stringstart
- the 0-based character index of the first character- Gibt zurück:
- the 0-based character index of the last character
- Löst aus:
IllegalArgumentException
- if this is not a type signature
-
scanBaseTypeSignature
public 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.BaseTypeSignature: B | C | D | F | I | J | S | V | Z
Note 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.- Parameter:
string
- the signature stringstart
- the 0-based character index of the first character- Gibt zurück:
- the 0-based character index of the last character
- Löst aus:
IllegalArgumentException
- if this is not a base type signature
-
scanArrayTypeSignature
public 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.ArrayTypeSignature: [ TypeSignature
- Parameter:
string
- the signature stringstart
- the 0-based character index of the first character- Gibt zurück:
- the 0-based character index of the last character
- Löst aus:
IllegalArgumentException
- if this is not an array type signature
-
scanCaptureTypeSignature
public 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.CaptureTypeSignature: ! TypeBoundSignature
- Parameter:
string
- the signature stringstart
- the 0-based character index of the first character- Gibt zurück:
- the 0-based character index of the last character
- Löst aus:
IllegalArgumentException
- if this is not a capture type signature
-
scanTypeVariableSignature
public 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.TypeVariableSignature: T Identifier ;
- Parameter:
string
- the signature stringstart
- the 0-based character index of the first character- Gibt zurück:
- the 0-based character index of the last character
- Löst aus:
IllegalArgumentException
- if this is not a type variable signature
-
scanIdentifier
public 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. Stop characters are: ";", ":", "<", ">", "/", ".".- Parameter:
string
- the signature stringstart
- the 0-based character index of the first character- Gibt zurück:
- the 0-based character index of the last character
- Löst aus:
IllegalArgumentException
- if this is not an identifier
-
scanClassTypeSignature
public 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.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.- Parameter:
string
- the signature stringstart
- the 0-based character index of the first character- Gibt zurück:
- the 0-based character index of the last character
- Löst aus:
IllegalArgumentException
- if this is not a class type signature
-
scanTypeBoundSignature
public 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.TypeBoundSignature: [-+] TypeSignature ; *
- Parameter:
string
- the signature stringstart
- the 0-based character index of the first character- Gibt zurück:
- the 0-based character index of the last character
- Löst aus:
IllegalArgumentException
- if this is not a type variable signature
-
scanTypeArgumentSignatures
public 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.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.- Parameter:
string
- the signature stringstart
- the 0-based character index of the first character- Gibt zurück:
- the 0-based character index of the last character
- Löst aus:
IllegalArgumentException
- if this is not a list of type arguments signatures
-
scanTypeArgumentSignature
public 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.TypeArgumentSignature: * | + TypeSignature | - TypeSignature | TypeSignature
Note that although base types are not allowed in type arguments, there is no syntactic ambiguity. This method will accept them without complaint.- Parameter:
string
- the signature stringstart
- the 0-based character index of the first character- Gibt zurück:
- the 0-based character index of the last character
- Löst aus:
IllegalArgumentException
- if this is not a type argument signature
-
effectivelyEqual
-
appendEscapedChar
-