# Class ProtocolManager

java.lang.Object
org.apache.zookeeper.compat.ProtocolManager

public final class ProtocolManager extends Object
A manager for switching behaviours between difference wire protocol.

Basically, wire protocol should be backward and forward compatible between minor versions. However, there are several cases that it's different due to Jute's limitations.

## Constructor Summary

Constructors
Constructor
Description
`ProtocolManager()`

## Method Summary

Modifier and Type
Method
Description
`ConnectRequest`
`deserializeConnectRequest(InputArchive inputArchive)`
Deserializing `ConnectRequest` should be specially handled for request from client version before and including ZooKeeper 3.3 which doesn't understand readOnly field.
`ConnectResponse`
`deserializeConnectResponse(InputArchive inputArchive)`
Deserializing `ConnectResponse` should be specially handled for response from server version before and including ZooKeeper 3.3 which doesn't understand readOnly field.
`boolean`
`isReadonlyAvailable()`
`void`
`serializeConnectResponse(ConnectResponse response, OutputArchive outputArchive)`
The serialization of `ConnectResponse` has to be handled specially as clients earlier than 3.5 might not expect the `readOnly` flag.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### ProtocolManager

public ProtocolManager()

## Method Details

### isReadonlyAvailable

public boolean isReadonlyAvailable()

### deserializeConnectRequest

public ConnectRequest deserializeConnectRequest(InputArchive inputArchive) throws IOException
Deserializing `ConnectRequest` should be specially handled for request from client version before and including ZooKeeper 3.3 which doesn't understand readOnly field.

Throws:
  `IOException`

### deserializeConnectResponse

public ConnectResponse deserializeConnectResponse(InputArchive inputArchive) throws IOException
Deserializing `ConnectResponse` should be specially handled for response from server version before and including ZooKeeper 3.3 which doesn't understand readOnly field.

Throws:
  `IOException`

### serializeConnectResponse

public void serializeConnectResponse(ConnectResponse response, OutputArchive outputArchive) throws IOException
The serialization of `ConnectResponse` has to be handled specially as clients earlier than 3.5 might not expect the `readOnly` flag.

Parameters:
  `response` - the response to serialize
  `outputArchive` - the serialization destination
Throws:
  `IOException`
See Also:
  - `deserializeConnectRequest(InputArchive)`