I'm trying to add custom behaviour to system classes (FileInputStream/FileOutputStream). I wrote custom ClassFileTransformer with the following transform method:
public byte[] transform(ClassLoader arg0, String arg1, Class arg2, ProtectionDomain arg3, byte[] arg4) throws IllegalClassFormatException {
System.out.println("class name: " + arg1);
return arg4;
}
When I run sample program:
public static void main(String[] args) throws Exception {
new FileOutputStream("file");
}
I see that no system classes are not passed to transform.
Is there any way to modify system classes? Thanks in advance!