From c4f7d38e865fe0230762cf890ce0cd782af5b7b9 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Tue, 20 May 2014 21:24:55 +0200 Subject: [PATCH] Javadocs and comments. --- .../org/eclipse/jetty/fcgi/parser/Parser.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/jetty-fcgi/fcgi-client/src/main/java/org/eclipse/jetty/fcgi/parser/Parser.java b/jetty-fcgi/fcgi-client/src/main/java/org/eclipse/jetty/fcgi/parser/Parser.java index 45a348f1396..83035532dbc 100644 --- a/jetty-fcgi/fcgi-client/src/main/java/org/eclipse/jetty/fcgi/parser/Parser.java +++ b/jetty-fcgi/fcgi-client/src/main/java/org/eclipse/jetty/fcgi/parser/Parser.java @@ -29,6 +29,10 @@ public abstract class Parser private State state = State.HEADER; private int padding; + /** + * @param buffer the bytes to parse + * @return true if the caller should stop parsing, false if the caller should continue parsing + */ public boolean parse(ByteBuffer buffer) { while (true) @@ -53,9 +57,16 @@ public abstract class Parser { ContentParser.Result result = contentParser.parse(buffer); if (result == ContentParser.Result.PENDING) + { + // Not enough data, signal to read/parse more. return false; - else if (result == ContentParser.Result.ASYNC) + } + if (result == ContentParser.Result.ASYNC) + { + // The content will be processed asynchronously, signal to stop + // parsing; the async operation will eventually resume parsing. return true; + } } padding = headerParser.getPaddingLength(); state = State.PADDING; @@ -99,6 +110,13 @@ public abstract class Parser public void onHeaders(int request); + /** + * @param request the request id + * @param stream the stream type + * @param buffer the content bytes + * @return true to signal to the parser to stop parsing, false to continue parsing + * @see Parser#parse(java.nio.ByteBuffer) + */ public boolean onContent(int request, FCGI.StreamType stream, ByteBuffer buffer); public void onEnd(int request);