Package net.bytebuddy.agent
Class VirtualMachine.ForHotSpot
- java.lang.Object
-
- net.bytebuddy.agent.VirtualMachine.ForHotSpot
-
- All Implemented Interfaces:
VirtualMachine
- Direct Known Subclasses:
VirtualMachine.ForHotSpot.OnUnix
- Enclosing interface:
- VirtualMachine
public abstract static class VirtualMachine.ForHotSpot extends java.lang.Object implements VirtualMachine
A virtual machine implementation for a HotSpot VM or any compatible VM.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
VirtualMachine.ForHotSpot.OnUnix
A virtual machine implementation for a HotSpot VM running on Unix.-
Nested classes/interfaces inherited from interface net.bytebuddy.agent.VirtualMachine
VirtualMachine.ForHotSpot
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
processId
The target process's id.
-
Constructor Summary
Constructors Modifier Constructor Description protected
ForHotSpot(java.lang.String processId)
Creates a new HotSpot-compatible VM implementation.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
connect()
Connects to the target VM.void
loadAgent(java.lang.String jarFile, java.lang.String argument)
Loads an agent into the represented virtual machine.protected abstract int
read(byte[] buffer)
Reads from the communication channel.protected abstract void
write(byte[] buffer)
Writes to the communication channel.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.bytebuddy.agent.VirtualMachine
detach
-
-
-
-
Method Detail
-
loadAgent
public void loadAgent(java.lang.String jarFile, java.lang.String argument) throws java.io.IOException
Description copied from interface:VirtualMachine
Loads an agent into the represented virtual machine.- Specified by:
loadAgent
in interfaceVirtualMachine
- Parameters:
jarFile
- The jar file to attach.argument
- The argument to provide ornull
if no argument should be provided.- Throws:
java.io.IOException
- If an I/O exception occurs.
-
connect
protected abstract void connect() throws java.io.IOException
Connects to the target VM.- Throws:
java.io.IOException
- If an I/O exception occurs.
-
read
protected abstract int read(byte[] buffer) throws java.io.IOException
Reads from the communication channel.- Parameters:
buffer
- The buffer to read into.- Returns:
- The amount of bytes read.
- Throws:
java.io.IOException
- If an I/O exception occurs.
-
write
protected abstract void write(byte[] buffer) throws java.io.IOException
Writes to the communication channel.- Parameters:
buffer
- The buffer to write from.- Throws:
java.io.IOException
- If an I/O exception occurs.
-
-