implement java_writeClassToDisk and java_redefineClassWithCustomClassFile
This commit is contained in:
parent
0d68531f9b
commit
d56665453f
@ -633,8 +633,6 @@ function java_findReferencesToObject(jObject)
|
||||
return result
|
||||
end
|
||||
|
||||
function java_redefineClassWithCustomClassFile(class, filename)
|
||||
end
|
||||
|
||||
function java_redefineClassWithCustomData(class, memory)
|
||||
javapipe.lock()
|
||||
@ -645,6 +643,13 @@ function java_redefineClassWithCustomData(class, memory)
|
||||
javapipe.unlock()
|
||||
end
|
||||
|
||||
function java_redefineClassWithCustomClassFile(class, filename)
|
||||
local f=assert(io.open(filename,"rb"))
|
||||
local data = f:read("*all")
|
||||
f:close()
|
||||
java_redefineClassWithCustomData(class, data)
|
||||
end
|
||||
|
||||
function java_getClassData(class)
|
||||
--gets the .class binary data (tip: Write a .class parser/editor so you can modify attributes and method bodies)
|
||||
local result={}
|
||||
@ -661,6 +666,13 @@ function java_getClassData(class)
|
||||
return result.data
|
||||
end
|
||||
|
||||
function java_writeClassToDisk(class, filename)
|
||||
local data=java_getClassData(class)
|
||||
local f=assert(io.open(filename,"wb"))
|
||||
f:write(data)
|
||||
f:close()
|
||||
end
|
||||
|
||||
|
||||
|
||||
function java_invokeMethod()
|
||||
|
Loading…
Reference in New Issue
Block a user