Package org.firebirdsql.gds.ng.wire

## Interface XdrStreamAccess

    public interface XdrStreamAccess

Provides access to the `XdrInputStream` and `XdrOutputStream`.

Since:
  3.0
Author:
  Mark Rotteveel

### Method Summary

All Methods Instance Methods Abstract Methods
`XdrInputStream` `getXdrIn()` Gets the XDR input stream.
`XdrOutputStream` `getXdrOut()` Gets the XDR output stream.
`void` `withTransmitLock​(TransmitAction transmitAction)` Runs `TransmitAction.transmit(XdrOutputStream)` with `getXdrOut()` on `transmitAction` under the transmit lock.

### Method Detail

#### getXdrIn

    XdrInputStream getXdrIn()
                     throws java.sql.SQLException

Gets the XDR input stream.

Returns:
  instance of `XdrInputStream`
Throws:
  `java.sql.SQLException` - if no connection is opened or when exceptions occur retrieving the InputStream

#### getXdrOut

    XdrOutputStream getXdrOut()
                       throws java.sql.SQLException

Gets the XDR output stream.

Returns:
  instance of `XdrOutputStream`
Throws:
  `java.sql.SQLException` - if no connection is opened or when exceptions occur retrieving the OutputStream
See Also:
  `withTransmitLock(TransmitAction)`

#### withTransmitLock

    void withTransmitLock​(TransmitAction transmitAction)
                   throws java.io.IOException,
                          java.sql.SQLException

Runs `TransmitAction.transmit(XdrOutputStream)` with `getXdrOut()` on `transmitAction` under the transmit lock.

For Jaybird 5 and 6, the transmit lock only needs to be used for statement operations and cancellation. See also jdp-2026-02: Cancellation thread-safety backport

The transmit lock should only cover sending messages to the server. It should be held for the duration of the entire message. It must be released before reading (receiving) messages from the server. If possible, do not do anything other than writing to the XDR output stream while holding the lock.

Normal operations must obtain the lock while holding the connection lock (i.e. the various `withLock()` methods). Out-of-band operations (e.g. cancellation) must not take out the connection lock, otherwise they can't be out-of-band.

Note for implementations: the lock used must be reentrant.

Parameters:
  `transmitAction` - the transmit action to run under lock
Throws:
  `java.io.IOException` - for errors writing to the XDR output stream
  `java.sql.SQLException` - for other database access errors
Since:
  5.0.11
See Also:
  `TransmitAction`