Class AbstractTransport

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

public abstract class AbstractTransport extends Object implements Closeable
Base class for all transport types.
Since:
v3.2.0 - 2019-02-08
Author:
hypfvieh
  • 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
    • authenticate

      protected void authenticate(OutputStream _out, InputStream _in, Socket _sock) throws IOException
      Helper method to authenticate to DBus using SASL.
      Parameters:
      _out - output stream
      _in - input stream
      _sock - socket
      Throws:
      IOException - on any error
    • setInputOutput

      protected void setInputOutput(Socket _socket)
      Setup message reader/writer. Will look for SPI provider first, if none is found default implementation is used. The default implementation does not support file descriptor passing!
      Parameters:
      _socket - socket to use
    • 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