commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1080826 - /commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/ReplyIterator.java
Date Sat, 12 Mar 2011 00:49:18 GMT
Author: sebb
Date: Sat Mar 12 00:49:17 2011
New Revision: 1080826

URL: http://svn.apache.org/viewvc?rev=1080826&view=rev
Log:
Make wrapping with DotTerminatedMessageReader optional

Modified:
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/ReplyIterator.java

Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/ReplyIterator.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/ReplyIterator.java?rev=1080826&r1=1080825&r2=1080826&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/ReplyIterator.java
(original)
+++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/ReplyIterator.java
Sat Mar 12 00:49:17 2011
@@ -40,14 +40,24 @@ class ReplyIterator implements Iterator<
     
     private Exception savedException;
 
-    ReplyIterator(Reader _reader) throws IOException {
-        reader = new BufferedReader(new DotTerminatedMessageReader(_reader));
+    /**
+     *
+     * @param _reader the reader to wrap
+     * @param addDotReader whether to additionally wrap the reader in a DotTerminatedMessageReader

+     * @throws IOException
+     */
+    ReplyIterator(Reader _reader, boolean addDotReader) throws IOException {
+        reader = new BufferedReader(addDotReader ? new DotTerminatedMessageReader(_reader)
: _reader);
         line = reader.readLine(); // prime the iterator
         if (line == null) {
             Util.closeQuietly(reader);
         }
     }
 
+    ReplyIterator(BufferedReader _reader) throws IOException {
+        this(_reader, true);
+    }
+
     public boolean hasNext() {
         if (savedException != null){
             throw new NoSuchElementException(savedException.toString());            



Mime
View raw message