commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1079598 - /commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NNTPClient.java
Date Tue, 08 Mar 2011 23:19:05 GMT
Author: sebb
Date: Tue Mar  8 23:19:05 2011
New Revision: 1079598

URL: http://svn.apache.org/viewvc?rev=1079598&view=rev
Log:
Add listOverviewFmt() method

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

Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NNTPClient.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NNTPClient.java?rev=1079598&r1=1079597&r2=1079598&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NNTPClient.java (original)
+++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NNTPClient.java Tue
Mar  8 23:19:05 2011
@@ -22,6 +22,7 @@ import java.io.IOException;
 import java.io.Reader;
 import java.io.StringWriter;
 import java.io.Writer;
+import java.util.ArrayList;
 import java.util.StringTokenizer;
 import java.util.Vector;
 
@@ -712,6 +713,27 @@ public class NNTPClient extends NNTP
         return help.toString();
     }
 
+    /**
+     * Send a "LIST OVERVIEW.FMT" command to the server.
+     * 
+     * @return the contents of the Overview format, of {@code null} if the command failed
+     * @throws IOException
+     */
+    public String[] listOverviewFmt() throws IOException
+    {
+        if (!NNTPReply.isPositiveCompletion(sendCommand("LIST", "OVERVIEW.FMT"))){
+            return null;
+        }
+
+        BufferedReader reader = new BufferedReader(new DotTerminatedMessageReader(_reader_));
+        String line;
+        ArrayList<String> list = new ArrayList<String>();
+        while((line=reader.readLine()) != null) {
+            list.add(line);
+        }
+        reader.close();
+        return list.toArray(new String[list.size()]);
+    }
 
     /***
      * Select an article by its unique identifier (including enclosing



Mime
View raw message