Top Description Fields Constructors Methods
org.freedesktop.dbus.spi.message

public abstract Class AbstractOutputStreamMessageWriter

extends Object
implements IMessageWriter
Class Inheritance
All Implemented Interfaces
org.freedesktop.dbus.spi.message.IMessageWriter, java.io.Closeable, java.lang.AutoCloseable
Known Direct Subclasses
org.freedesktop.dbus.spi.message.OutputStreamMessageWriter
Imports
org.freedesktop.dbus.FileDescriptor, org.freedesktop.dbus.messages.Message, org.freedesktop.dbus.utils.Hexdump, org.slf4j.Logger, .LoggerFactory, java.io.IOException, java.nio.ByteBuffer, java.nio.channels.SocketChannel, java.util.List, .Objects

Base class which can be used to implement a custom message writer.
Since
4.3.1 - 2023-08-07

Field Summary

Modifier and TypeField and Description
private final Logger
private final SocketChannel
private final ISocketProvider

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements java.io.Closeable.close.

Closes this stream and releases any system resources associated with it.

protected Logger
protected ISocketProvider
public boolean
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

protected abstract void
writeFileDescriptors(SocketChannel
channel to write to
_outputChannel
,
List<FileDescriptor>
file descriptors attached to message
_filedescriptors
)

Called to write any file descriptors to the given channel.

public final void
writeMessage(Message
The message to write
_msg
)

Implements org.freedesktop.dbus.spi.message.IMessageWriter.writeMessage.

Write a message out to the bus.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

loggerback to summary
private final Logger logger
outputChannelback to summary
private final SocketChannel outputChannel
socketProviderImplback to summary
private final ISocketProvider socketProviderImpl

Constructor Detail

AbstractOutputStreamMessageWriterback to summary
protected AbstractOutputStreamMessageWriter(final SocketChannel _out, ISocketProvider _socketProviderImpl)

Method Detail

closeback to summary
public void close() throws IOException

Implements java.io.Closeable.close.

Doc from java.io.Closeable.close.

Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

As noted in AutoCloseable#close(), cases where the close may fail require careful attention. It is strongly advised to relinquish the underlying resources and to internally mark the Closeable as closed, prior to throwing the IOException.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
getLoggerback to summary
protected Logger getLogger()
getSocketProviderImplback to summary
protected ISocketProvider getSocketProviderImpl()
isClosedback to summary
public boolean isClosed()

Implements org.freedesktop.dbus.spi.message.IMessageWriter.isClosed.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
writeFileDescriptorsback to summary
protected abstract void writeFileDescriptors(SocketChannel _outputChannel, List<FileDescriptor> _filedescriptors) throws IOException

Called to write any file descriptors to the given channel.
Should do nothing if there is no file descriptor to write, or method is not supported.

Parameters
_outputChannel:SocketChannel

channel to write to

_filedescriptors:List<FileDescriptor>

file descriptors attached to message

Exceptions
IOException:
when writing the descriptors fail
writeMessageback to summary
public final void writeMessage(Message _msg) throws IOException

Implements org.freedesktop.dbus.spi.message.IMessageWriter.writeMessage.

Doc from org.freedesktop.dbus.spi.message.IMessageWriter.writeMessage.

Write a message out to the bus.

Parameters
_msg:Message

The message to write

Annotations
@Override
Exceptions
IOException:
If an IO error occurs.