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
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
function java_redefineClassWithCustomClassFile(class, filename)
|
|
||||||
end
|
|
||||||
|
|
||||||
function java_redefineClassWithCustomData(class, memory)
|
function java_redefineClassWithCustomData(class, memory)
|
||||||
javapipe.lock()
|
javapipe.lock()
|
||||||
@ -645,6 +643,13 @@ function java_redefineClassWithCustomData(class, memory)
|
|||||||
javapipe.unlock()
|
javapipe.unlock()
|
||||||
end
|
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)
|
function java_getClassData(class)
|
||||||
--gets the .class binary data (tip: Write a .class parser/editor so you can modify attributes and method bodies)
|
--gets the .class binary data (tip: Write a .class parser/editor so you can modify attributes and method bodies)
|
||||||
local result={}
|
local result={}
|
||||||
@ -661,6 +666,13 @@ function java_getClassData(class)
|
|||||||
return result.data
|
return result.data
|
||||||
end
|
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()
|
function java_invokeMethod()
|
||||||
|
Loading…
Reference in New Issue
Block a user