Package net.bytebuddy.agent
Class VirtualMachine.ForHotSpot.Connection.OnPersistentByteChannel<T>
- java.lang.Object
-
- net.bytebuddy.agent.VirtualMachine.ForHotSpot.Connection.OnPersistentByteChannel<T>
-
- Type Parameters:
T
- The connection representation.
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,VirtualMachine.ForHotSpot.Connection
- Enclosing interface:
- VirtualMachine.ForHotSpot.Connection
public abstract static class VirtualMachine.ForHotSpot.Connection.OnPersistentByteChannel<T> extends java.lang.Object implements VirtualMachine.ForHotSpot.Connection
A connection that is represented by a byte channel that is persistent during communication.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
VirtualMachine.ForHotSpot.Connection.OnPersistentByteChannel.Response
A response of a persistent byte channel.-
Nested classes/interfaces inherited from interface net.bytebuddy.agent.VirtualMachine.ForHotSpot.Connection
VirtualMachine.ForHotSpot.Connection.Factory, VirtualMachine.ForHotSpot.Connection.OnPersistentByteChannel<T>
-
-
Field Summary
Fields Modifier and Type Field Description private static byte[]
BLANK
A blank line argument.
-
Constructor Summary
Constructors Constructor Description OnPersistentByteChannel()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
close(T connection)
Closes the connection to the target VM.protected abstract T
connect()
Creates a new connection to the target VM.VirtualMachine.ForHotSpot.Connection.Response
execute(java.lang.String protocol, java.lang.String... argument)
Executes a command on the current connection.protected abstract int
read(T connection, byte[] buffer)
Reads from the target VM.protected abstract void
write(T connection, byte[] buffer)
Writes to the target VM.
-
-
-
Method Detail
-
execute
public VirtualMachine.ForHotSpot.Connection.Response execute(java.lang.String protocol, java.lang.String... argument) throws java.io.IOException
Executes a command on the current connection.- Specified by:
execute
in interfaceVirtualMachine.ForHotSpot.Connection
- Parameters:
protocol
- The target VMs protocol version for the attach API.argument
- The arguments to send to the target VM.- Returns:
- The response of the target JVM.
- Throws:
java.io.IOException
- If an I/O error occurred.
-
connect
protected abstract T connect() throws java.io.IOException
Creates a new connection to the target VM.- Returns:
- Returns a new connection to the target VM.
- Throws:
java.io.IOException
- If an I/O exception occurs.
-
close
protected abstract void close(T connection) throws java.io.IOException
Closes the connection to the target VM.- Parameters:
connection
- The connection to close.- Throws:
java.io.IOException
- If an I/O exception occurs.
-
write
protected abstract void write(T connection, byte[] buffer) throws java.io.IOException
Writes to the target VM.- Parameters:
connection
- The connection to write to.buffer
- The buffer to write to.- Throws:
java.io.IOException
- If an I/O exception occurs during writing.
-
read
protected abstract int read(T connection, byte[] buffer) throws java.io.IOException
Reads from the target VM.- Parameters:
connection
- The connection to read from.buffer
- The buffer to store the result in.- Returns:
- The number of byte that were read.
- Throws:
java.io.IOException
- If an I/O exception occurs.
-
-