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 Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidauthenticate(OutputStream _out, InputStream _in, Socket _sock)Helper method to authenticate to DBus using SASL.voidclose()protected BusAddressgetAddress()protected org.slf4j.LoggergetLogger()protected intgetSaslAuthMode()protected SASL.SaslModegetSaslMode()MessagereadMessage()Read a message from the underlying socket.protected voidsetInputOutput(Socket _socket)Setup message reader/writer.protected voidsetSaslAuthMode(int _saslAuthMode)protected voidsetSaslMode(SASL.SaslMode _saslMode)voidwriteMessage(Message _msg)Write a message to the underlying socket.
-
-
-
Method Detail
-
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 nullDBusException- 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:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
-