Top Description Fields Constructors Methods
org.eclipse.jgit.transport.sshd.agent

public abstract Class AbstractConnector

extends Object
implements Connector
Class Inheritance
All Implemented Interfaces
org.eclipse.jgit.transport.sshd.agent.Connector, java.io.Closeable, java.lang.AutoCloseable
Imports
java.io.IOException, java.text.MessageFormat, java.util.Objects, org.apache.sshd.agent.SshAgentConstants, org.apache.sshd.common.SshException, org.apache.sshd.common.util.buffer.BufferUtils, org.eclipse.jgit.internal.transport.sshd.SshdText

Provides some utility methods for implementing Connectors.
Since
6.0

Field Summary

Modifier and TypeField and Description
protected static final int
DEFAULT_MAX_REPLY_LENGTH

Default maximum reply length.

private final int
private static final int

Constructor Summary

AccessConstructor and Description
protected
AbstractConnector()

Creates a new instance using the DEFAULT_MAX_REPLY_LENGTH.

protected
AbstractConnector(int
maximum number of payload bytes we're ready to accept
maxReplyLength
)

Creates a new instance.

Method Summary

Modifier and TypeMethod and Description
protected int

Returns:

the maximum message length
getMaximumMessageLength
()

Retrieves the maximum message length this AbstractConnector is configured for.

protected void
prepareMessage(byte
SSH agent command the request is for
command
,
byte[]
about to be sent, including the 5 spare bytes at the front
message
)

Prepares a message for sending by inserting the command and message length.

protected int

Returns:

the length as an int
toLength
(byte
SSH agent command the reply is for
command
,
byte[]
length as received: number of payload bytes
length
)

Checks the received length of a reply.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEFAULT_MAX_REPLY_LENGTHback to summary
protected static final int DEFAULT_MAX_REPLY_LENGTH

Default maximum reply length. 256kB is the OpenSSH limit.

maxReplyLengthback to summary
private final int maxReplyLength
MIN_REPLY_LENGTHback to summary
private static final int MIN_REPLY_LENGTH

Constructor Detail

AbstractConnectorback to summary
protected AbstractConnector()

Creates a new instance using the DEFAULT_MAX_REPLY_LENGTH.

AbstractConnectorback to summary
protected AbstractConnector(int maxReplyLength)

Creates a new instance.

Parameters
maxReplyLength:int

maximum number of payload bytes we're ready to accept

Method Detail

getMaximumMessageLengthback to summary
protected int getMaximumMessageLength()

Retrieves the maximum message length this AbstractConnector is configured for.

Returns:int

the maximum message length

prepareMessageback to summary
protected void prepareMessage(byte command, byte[] message) throws IllegalArgumentException

Prepares a message for sending by inserting the command and message length.

Parameters
command:byte

SSH agent command the request is for

message:byte[]

about to be sent, including the 5 spare bytes at the front

Exceptions
IllegalArgumentException:
if message has less than 5 bytes
toLengthback to summary
protected int toLength(byte command, byte[] length) throws IOException

Checks the received length of a reply.

Parameters
command:byte

SSH agent command the reply is for

length:byte[]

length as received: number of payload bytes

Returns:int

the length as an int

Exceptions
IOException:
if the length is invalid