Package org.apache.tomcat.jakartaee
Class ClassConverter
java.lang.Object
org.apache.tomcat.jakartaee.ClassConverter
- All Implemented Interfaces:
ClassFileTransformer,Converter
Class converter and transformer.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreate a class converter with the default TOMCAT profile.ClassConverter(EESpecProfile profile) Create a class converter with the specified spec profile. -
Method Summary
Modifier and TypeMethodDescriptionbooleanCheck if the file can be processed by this converter.booleanconvert(String path, InputStream src, OutputStream dest, EESpecProfile profile) Copies the source to the destination, converting it if necessary, according to the requirements of the given profile.protected booleanconvertInternal(String path, InputStream src, OutputStream dest, EESpecProfile profile, ClassLoader loader) Convert specified class bytecode.toString()byte[]transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.instrument.ClassFileTransformer
transform
-
Field Details
-
profile
The configured spec profile.
-
-
Constructor Details
-
ClassConverter
public ClassConverter()Create a class converter with the default TOMCAT profile. -
ClassConverter
Create a class converter with the specified spec profile.- Parameters:
profile- the specification profile to use for conversion
-
-
Method Details
-
toString
-
accepts
Description copied from interface:ConverterCheck if the file can be processed by this converter. -
convert
public boolean convert(String path, InputStream src, OutputStream dest, EESpecProfile profile) throws IOException Description copied from interface:ConverterCopies the source to the destination, converting it if necessary, according to the requirements of the given profile.- Specified by:
convertin interfaceConverter- Parameters:
path- The path to the data being convertedsrc- The source data to convertdest- The destination to write the converted dataprofile- The profile that defines the conversion required- Returns:
- true if the converter made a conversion to the file
- Throws:
IOException- If the conversion fails
-
transform
public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException - Specified by:
transformin interfaceClassFileTransformer- Throws:
IllegalClassFormatException
-
convertInternal
protected boolean convertInternal(String path, InputStream src, OutputStream dest, EESpecProfile profile, ClassLoader loader) throws IOException Convert specified class bytecode.- Parameters:
path- the pathsrc- the source byte streamdest- the output byte streamprofile- the specification profile to useloader- the class loader- Returns:
- true if conversion occurred
- Throws:
IOException- rethrow on byte read or write
-