Package org.eclipse.jgit.transport
Class ProtocolV2Parser
- java.lang.Object
-
- org.eclipse.jgit.transport.ProtocolV2Parser
-
final class ProtocolV2Parser extends java.lang.Object
Parse the incoming git protocol lines from the wire and translate them into a Request object. It requires a transferConfig object to know what the server supports (e.g. ref-in-want and/or filters).
-
-
Field Summary
Fields Modifier and Type Field Description private TransferConfig
transferConfig
-
Constructor Summary
Constructors Constructor Description ProtocolV2Parser(TransferConfig transferConfig)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static java.lang.String
consumeCapabilities(PacketLineIn pckIn, java.util.function.Consumer<java.lang.String> serverOptionConsumer, java.util.function.Consumer<java.lang.String> agentConsumer)
(package private) FetchV2Request
parseFetchRequest(PacketLineIn pckIn)
Parse the incoming fetch request arguments from the wire.(package private) LsRefsV2Request
parseLsRefsRequest(PacketLineIn pckIn)
Parse the incoming ls-refs request arguments from the wire.(package private) ObjectInfoRequest
parseObjectInfoRequest(PacketLineIn pckIn)
-
-
-
Field Detail
-
transferConfig
private final TransferConfig transferConfig
-
-
Constructor Detail
-
ProtocolV2Parser
ProtocolV2Parser(TransferConfig transferConfig)
-
-
Method Detail
-
consumeCapabilities
private static java.lang.String consumeCapabilities(PacketLineIn pckIn, java.util.function.Consumer<java.lang.String> serverOptionConsumer, java.util.function.Consumer<java.lang.String> agentConsumer) throws java.io.IOException
- Throws:
java.io.IOException
-
parseFetchRequest
FetchV2Request parseFetchRequest(PacketLineIn pckIn) throws PackProtocolException, java.io.IOException
Parse the incoming fetch request arguments from the wire. The caller must be sure that what is comings is a fetch request before coming here.- Parameters:
pckIn
- incoming lines- Returns:
- A FetchV2Request populated with information received from the wire.
- Throws:
PackProtocolException
- incompatible options, wrong type of arguments or other issues where the request breaks the protocol.java.io.IOException
- an IO error prevented reading the incoming message.
-
parseLsRefsRequest
LsRefsV2Request parseLsRefsRequest(PacketLineIn pckIn) throws PackProtocolException, java.io.IOException
Parse the incoming ls-refs request arguments from the wire. This is meant for calling immediately after the caller has consumed a "command=ls-refs" line indicating the beginning of a ls-refs request. The incoming PacketLineIn is consumed until an END line, but the caller is responsible for closing it (if needed)- Parameters:
pckIn
- incoming lines. This method will read until an END line.- Returns:
- a LsRefsV2Request object with the data received in the wire.
- Throws:
PackProtocolException
- for inconsistencies in the protocol (e.g. unexpected lines)java.io.IOException
- reporting problems reading the incoming messages from the wire
-
parseObjectInfoRequest
ObjectInfoRequest parseObjectInfoRequest(PacketLineIn pckIn) throws PackProtocolException, java.io.IOException
- Throws:
PackProtocolException
java.io.IOException
-
-