Class AbstractTransport

java.lang.Object
org.freedesktop.dbus.connections.transports.AbstractTransport
All Implemented Interfaces:
Closeable, AutoCloseable
Direct Known Subclasses:
AbstractUnixTransport

public abstract class AbstractTransport extends Object implements Closeable
Base class for all transport types.
Since:
v3.2.0 - 2019-02-08
Author:
hypfvieh
  • Constructor Details

    • AbstractTransport

      protected AbstractTransport(BusAddress _address)
  • Method Details

    • writeMessage

      public void writeMessage(Message _msg) throws IOException
      Write a message to the underlying socket.
      Parameters:
      _msg - message to write
      Throws:
      IOException - on write error or if output was already closed or null
    • readMessage

      public Message readMessage() throws IOException, DBusException
      Read a message from the underlying socket.
      Returns:
      read message, maybe null
      Throws:
      IOException - when input already close or null
      DBusException - when message could not be converted to a DBus message
    • isConnected

      public boolean isConnected()
      Returns true if inputReader and outputWriter are not yet closed.
      Returns:
      boolean
    • hasFileDescriptorSupport

      protected abstract boolean hasFileDescriptorSupport()
      Method to indicate if passing of file descriptors is allowed.
      Returns:
      true to allow FD passing, false otherwise
    • isAbstractAllowed

      protected abstract boolean isAbstractAllowed()
      Return true if the transport supports 'abstract' sockets.
      Returns:
      true if abstract sockets supported, false otherwise
    • connectImpl

      protected abstract SocketChannel connectImpl() throws IOException
      Abstract method implemented by concrete sub classes to establish a connection using whatever transport type (e.g. TCP/Unix socket).
      Throws:
      IOException - when connection fails
    • connect

      public final SocketChannel connect() throws IOException
      Establish connection on created transport.
      Returns:
      SocketChannel
      Throws:
      IOException - if connection fails
    • getSaslAuthMode

      protected int getSaslAuthMode()
    • setSaslAuthMode

      protected void setSaslAuthMode(int _saslAuthMode)
    • getSaslMode

      protected SASL.SaslMode getSaslMode()
    • setSaslMode

      protected void setSaslMode(SASL.SaslMode _saslMode)
    • getAddress

      protected BusAddress getAddress()
    • getLogger

      protected org.slf4j.Logger getLogger()
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException