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
FieldsModifier and TypeFieldDescriptionprivate static final Logger
protected final EESpecProfile
The configured spec profile.private static final StringManager
-
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 TypeMethodDescriptionboolean
Check if the file can be processed by this converter.boolean
convert
(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 boolean
convertInternal
(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)
-
Field Details
-
logger
-
sm
-
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:Converter
Check 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:Converter
Copies the source to the destination, converting it if necessary, according to the requirements of the given profile.- Specified by:
convert
in 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:
transform
in 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
-