diff options
author | David Pursehouse <david.pursehouse@gmail.com> | 2019-05-30 20:31:39 +0900 |
---|---|---|
committer | David Pursehouse <david.pursehouse@gmail.com> | 2019-05-30 20:31:39 +0900 |
commit | d2425e16f465303905ba23309d876127faa93af1 (patch) | |
tree | 163b642ecb43a486b78f0c9862ab06f8e7fa3684 /org.eclipse.jgit | |
parent | 9f5d271b12e93f927b18e76a1a8c1f650cd40cdf (diff) | |
download | jgit-d2425e16f465303905ba23309d876127faa93af1.tar.gz jgit-d2425e16f465303905ba23309d876127faa93af1.zip |
PacketLineIn: Add helper methods to check for END and DELIM
These methods will allow clients to check for END and DELIM without
doing a reference comparison on the String objects, which raises
warnings from Error Prone.
Change-Id: I9e7e59843553ed4488ee8e864033198bbb60d67c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java index c6e19d5762..15d3481f4c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java @@ -224,6 +224,30 @@ public class PacketLineIn { return s; } + /** + * Check if a string is the delimiter marker. + * + * @param s + * the string to check + * @return true if the given string is {@link #DELIM}, otherwise false. + * @since 5.4 + */ + public static boolean isDelim(String s) { + return s == DELIM; + } + + /** + * Check if a string is the packet end marker. + * + * @param s + * the string to check + * @return true if the given string is {@link #END}, otherwise false. + * @since 5.4 + */ + public static boolean isEnd(String s) { + return s == END; + } + void discardUntilEnd() throws IOException { for (;;) { int n = readLength(); |