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:
Closeable, AutoCloseable, VirtualMachine.ForHotSpot.Connection
Enclosing interface:
VirtualMachine.ForHotSpot.Connection

public abstract static class VirtualMachine.ForHotSpot.Connection.OnPersistentByteChannel<T> extends Object implements VirtualMachine.ForHotSpot.Connection
A connection that is represented by a byte channel that is persistent during communication.
  • Field Details

    • BLANK

      private static final byte[] BLANK
      A blank line argument.
  • Constructor Details

    • OnPersistentByteChannel

      public OnPersistentByteChannel()
  • Method Details

    • execute

      public VirtualMachine.ForHotSpot.Connection.Response execute(String protocol, String... argument) throws IOException
      Executes a command on the current connection.
      Specified by:
      execute in interface VirtualMachine.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:
      IOException - If an I/O error occurred.
    • connect

      protected abstract T connect() throws IOException
      Creates a new connection to the target VM.
      Returns:
      Returns a new connection to the target VM.
      Throws:
      IOException - If an I/O exception occurs.
    • close

      protected abstract void close(T connection) throws IOException
      Closes the connection to the target VM.
      Parameters:
      connection - The connection to close.
      Throws:
      IOException - If an I/O exception occurs.
    • write

      protected abstract void write(T connection, byte[] buffer) throws IOException
      Writes to the target VM.
      Parameters:
      connection - The connection to write to.
      buffer - The buffer to write to.
      Throws:
      IOException - If an I/O exception occurs during writing.
    • read

      protected abstract int read(T connection, byte[] buffer) throws 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:
      IOException - If an I/O exception occurs.