diff options
author | Matti Tahvonen <matti.tahvonen@itmill.com> | 2010-10-15 14:39:53 +0000 |
---|---|---|
committer | Matti Tahvonen <matti.tahvonen@itmill.com> | 2010-10-15 14:39:53 +0000 |
commit | 9e1b09408e104e27ac5c83c320e6699b98091383 (patch) | |
tree | 495fdd57a681b8abf37f298aa445dd78806857bc | |
parent | 476cc52d9b78174d36629697338fbc8295ecc833 (diff) | |
download | vaadin-framework-9e1b09408e104e27ac5c83c320e6699b98091383.tar.gz vaadin-framework-9e1b09408e104e27ac5c83c320e6699b98091383.zip |
better line docs for multipart reader
svn changeset:15573/svn branch:6.5
-rw-r--r-- | src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java index 662bdcf7d5..7c4a410a81 100644 --- a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java +++ b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java @@ -426,9 +426,22 @@ public abstract class AbstractCommunicationManager implements * buffering mode bytes are read until the character does not match the * corresponding from boundary string or the full boundary string is * found. + * + * Note, if this is someday needed elsewhere, don't shoot yourself to + * foot and split to a top level helper class. */ InputStream simpleMultiPartReader = new InputStream() { + + /** + * Counter of how many characters have been matched to boundary + * string from the stream + */ int matchedCount = 0; + + /** + * Used as pointer when returning bytes after partly matched + * boundary string. + */ int curBoundaryIndex = 0; /** * The byte found after a "promising start for boundary" @@ -441,6 +454,7 @@ public abstract class AbstractCommunicationManager implements if (atTheEnd) { return -1; } else if (bufferedByte >= 0) { + /* "buffered mode", purge partially matched boundary */ return getBuffered(); } else { int fromActualStream = inputStream.read(); @@ -450,6 +464,10 @@ public abstract class AbstractCommunicationManager implements "The multipart stream ended unexpectedly"); } if (charArray[matchedCount] == fromActualStream) { + /* + * Going to "buffered mode". Read until full boundary + * match or a different character. + */ while (true) { matchedCount++; if (matchedCount == charArray.length) { |