Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A65B9F080 for ; Fri, 22 Mar 2013 17:55:07 +0000 (UTC) Received: (qmail 8067 invoked by uid 500); 22 Mar 2013 17:55:07 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 7987 invoked by uid 500); 22 Mar 2013 17:55:07 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 7978 invoked by uid 99); 22 Mar 2013 17:55:07 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Mar 2013 17:55:07 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Mar 2013 17:54:54 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id C1ACB23889ED for ; Fri, 22 Mar 2013 17:54:09 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r855595 [7/13] - in /websites/production/commons/content/proper/commons-csv: ./ apidocs/ apidocs/org/apache/commons/csv/ apidocs/org/apache/commons/csv/class-use/ apidocs/src-html/org/apache/commons/csv/ cobertura/ xref/org/apache/commons/csv/ Date: Fri, 22 Mar 2013 17:54:07 -0000 To: commits@commons.apache.org From: ggregory@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130322175409.C1ACB23889ED@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: websites/production/commons/content/proper/commons-csv/cobertura/org.apache.commons.csv.CSVParser.html ============================================================================== --- websites/production/commons/content/proper/commons-csv/cobertura/org.apache.commons.csv.CSVParser.html (original) +++ websites/production/commons/content/proper/commons-csv/cobertura/org.apache.commons.csv.CSVParser.html Fri Mar 22 17:54:06 2013 @@ -156,7 +156,7 @@  68  
  *
 69   -
  * @version $Id: CSVParser.java 1458683 2013-03-20 08:31:14Z britter $
+
  * @version $Id: CSVParser.java 1459447 2013-03-21 18:47:40Z ggregory $
 70  
  */
 71   @@ -177,8 +177,8 @@
 
 79  
     /** A record buffer for getRecord(). Grows as necessary and is reused. */
-  80  60116
     private final List<String> record = new ArrayList<String>();
-  81  60116
     private final Token reusableToken = new Token();
+  80  180348
     private final List<String> record = new ArrayList<String>();
+  81  180348
     private final Token reusableToken = new Token();
 82  
 
 83   @@ -199,8 +199,8 @@
      */
 91  
     public CSVParser(final Reader input) throws IOException {
-  92  32
         this(input, CSVFormat.DEFAULT);
-  93  32
     }
+  92  96
         this(input, CSVFormat.DEFAULT);
+  93  96
     }
 94  
 
 95   @@ -212,7 +212,7 @@  98  
      * @param input
 99   -
      *            a Reader containing "csv-formatted" input
+
      *            a Reader containing CSV-formatted input
 100  
      * @param format
 101   @@ -223,10 +223,10 @@
      *             thrown if the parameters of the format are inconsistent
 104  
      */
-  105  60116
     public CSVParser(final Reader input, final CSVFormat format) throws IOException {
-  106  60116
         this.lexer = new CSVLexer(format, new ExtendedBufferedReader(input));
-  107  60116
         this.headerMap = initializeHeader(format);
-  108  60116
     }
+  105  180348
     public CSVParser(final Reader input, final CSVFormat format) throws IOException {
+  106  180348
         this.lexer = new CSVLexer(format, new ExtendedBufferedReader(input));
+  107  180348
         this.headerMap = initializeHeader(format);
+  108  180348
     }
 109  
 
 110   @@ -251,8 +251,8 @@
      */
 120  
     public CSVParser(final String input, final CSVFormat format) throws IOException {
-  121  60054
         this(new StringReader(input), format);
-  122  60054
     }
+  121  180162
         this(new StringReader(input), format);
+  122  180162
     }
 123  
 
 124   @@ -294,7 +294,7 @@
      */
 143  
     public long getLineNumber() {
-  144  40
         return lexer.getLineNumber();
+  144  120
         return lexer.getLineNumber();
 145  
     }
 146   @@ -315,7 +315,7 @@
      */
 154  
     public long getRecordNumber() {
-  155  40
         return recordNumber;
+  155  120
         return recordNumber;
 156  
     }
 157   @@ -336,26 +336,26 @@
      */
 165  
     CSVRecord nextRecord() throws IOException {
-  166  210699
         CSVRecord result = null;
-  167  210699
         record.clear();
-  168  210699
         StringBuilder sb = null;
+  166  631343
         CSVRecord result = null;
+  167  631343
         record.clear();
+  168  631343
         StringBuilder sb = null;
 169  
         do {
-  170  361192
             reusableToken.reset();
-  171  361192
             lexer.nextToken(reusableToken);
-  172  361192
             switch (reusableToken.type) {
+  170  1083349
             reusableToken.reset();
+  171  1083349
             lexer.nextToken(reusableToken);
+  172  1083349
             switch (reusableToken.type) {
 173  
             case TOKEN:
-  174  150453
                 record.add(reusableToken.content.toString());
-  175  150453
                 break;
+  174  451886
                 record.add(reusableToken.content.toString());
+  175  451886
                 break;
 176  
             case EORECORD:
-  177  150529
                 record.add(reusableToken.content.toString());
-  178  150529
                 break;
+  177  450833
                 record.add(reusableToken.content.toString());
+  178  450833
                 break;
 179  
             case EOF:
-  180  60170
                 if (reusableToken.isReady) {
-  181  52
                     record.add(reusableToken.content.toString());
+  180  180510
                 if (reusableToken.isReady) {
+  181  156
                     record.add(reusableToken.content.toString());
 182  
                 }
 183   @@ -365,29 +365,29 @@  185  0
                 throw new IOException("(line " + getLineNumber() + ") invalid parse sequence");
 186  
             case COMMENT: // Ignored currently
-  187  40
                 if (sb == null) { // first comment for this record
-  188  30
                     sb = new StringBuilder();
+  187  120
                 if (sb == null) { // first comment for this record
+  188  90
                     sb = new StringBuilder();
 189  
                 } else {
-  190  10
                     sb.append("\n");
+  190  30
                     sb.append("\n");
 191  
                 }
-  192  40
                 sb.append(reusableToken.content);
-  193  40
                 reusableToken.type = TOKEN; // Read another token
+  192  120
                 sb.append(reusableToken.content);
+  193  120
                 reusableToken.type = TOKEN; // Read another token
 194  
                 break;
 195  
             }
-  196  361192
         } while (reusableToken.type == TOKEN);
+  196  1083349
         } while (reusableToken.type == TOKEN);
 197  
 
-  198  210699
         if (!record.isEmpty()) {
-  199  150581
             recordNumber++;
-  200  150581
             final String comment = sb == null ? null : sb.toString();
-  201  150581
             result = new CSVRecord(record.toArray(new String[record.size()]), headerMap, comment, this.recordNumber);
+  198  631343
         if (!record.isEmpty()) {
+  199  450989
             recordNumber++;
+  200  450989
             final String comment = sb == null ? null : sb.toString();
+  201  450989
             result = new CSVRecord(record.toArray(new String[record.size()]), headerMap, comment, this.recordNumber);
 202  
         }
-  203  210699
         return result;
+  203  631343
         return result;
 204  
     }
 205   @@ -414,14 +414,14 @@
      */
 216  
     public List<CSVRecord> getRecords() throws IOException {
-  217  60072
         final List<CSVRecord> records = new ArrayList<CSVRecord>();
+  217  180216
         final List<CSVRecord> records = new ArrayList<CSVRecord>();
 218  
         CSVRecord rec;
-  219  210445
         while ((rec = nextRecord()) != null) {
-  220  150373
             records.add(rec);
+  219  630581
         while ((rec = nextRecord()) != null) {
+  220  450365
             records.add(rec);
 221  
         }
-  222  60072
         return records;
+  222  180216
         return records;
 223  
     }
 224   @@ -434,38 +434,38 @@
      */
 228  
     private Map<String, Integer> initializeHeader(final CSVFormat format) throws IOException {
-  229  60116
         Map<String, Integer> hdrMap = null;
-  230  60116
         if (format.getHeader() != null) {
-  231  8
             hdrMap = new LinkedHashMap<String, Integer>();
+  229  180348
         Map<String, Integer> hdrMap = null;
+  230  180348
         if (format.getHeader() != null) {
+  231  24
             hdrMap = new LinkedHashMap<String, Integer>();
 232  
 
-  233  8
             String[] header = null;
-  234  8
             if (format.getHeader().length == 0) {
+  233  24
             String[] header = null;
+  234  24
             if (format.getHeader().length == 0) {
 235  
                 // read the header from the first line of the file
-  236  4
                 final CSVRecord rec = nextRecord();
-  237  4
                 if (rec != null) {
-  238  4
                     header = rec.values();
+  236  12
                 final CSVRecord rec = nextRecord();
+  237  12
                 if (rec != null) {
+  238  12
                     header = rec.values();
 239  
                 }
-  240  4
             } else {
-  241  4
                 header = format.getHeader();
+  240  12
             } else {
+  241  12
                 header = format.getHeader();
 242  
             }
 243  
 
 244  
             // build the name to index mappings
-  245  8
             if (header != null) {
-  246  32
                 for (int i = 0; i < header.length; i++) {
-  247  24
                     hdrMap.put(header[i], Integer.valueOf(i));
+  245  24
             if (header != null) {
+  246  96
                 for (int i = 0; i < header.length; i++) {
+  247  72
                     hdrMap.put(header[i], Integer.valueOf(i));
 248  
                 }
 249  
             }
 250  
         }
-  251  60116
         return hdrMap;
+  251  180348
         return hdrMap;
 252  
     }
 253   @@ -480,7 +480,7 @@
      */
 258  
     public Iterator<CSVRecord> iterator() {
-  259  26
         return new Iterator<CSVRecord>() {
+  259  78
         return new Iterator<CSVRecord>() {
 260  
             private CSVRecord current;
 261   @@ -489,7 +489,7 @@
             private CSVRecord getNextRecord() {
 263  
                 try {
-  264  182
                     return nextRecord();
+  264  546
                     return nextRecord();
 265  0
                 } catch (final IOException e) {
 266  
                     // TODO: This is not great, throw an ISE instead?
@@ -502,43 +502,43 @@
 
 271  
             public boolean hasNext() {
-  272  178
                 if (current == null) {
-  273  174
                     current = getNextRecord();
+  272  534
                 if (current == null) {
+  273  522
                     current = getNextRecord();
 274  
                 }
 275  
 
-  276  178
                 return current != null;
+  276  534
                 return current != null;
 277  
             }
 278  
 
 279  
             public CSVRecord next() {
-  280  156
                 CSVRecord next = current;
-  281  156
                 current = null;
+  280  468
                 CSVRecord next = current;
+  281  468
                 current = null;
 282  
 
-  283  156
                 if (next == null) {
+  283  468
                 if (next == null) {
 284  
                     // hasNext() wasn't called before
-  285  8
                     next = getNextRecord();
-  286  8
                     if (next == null) {
-  287  2
                         throw new NoSuchElementException("No more CSV records available");
+  285  24
                     next = getNextRecord();
+  286  24
                     if (next == null) {
+  287  6
                         throw new NoSuchElementException("No more CSV records available");
 288  
                     }
 289  
                 }
 290  
 
-  291  154
                 return next;
+  291  462
                 return next;
 292  
             }
 293  
 
 294  
             public void remove() {
-  295  2
                 throw new UnsupportedOperationException();
+  295  6
                 throw new UnsupportedOperationException();
 296  
             }
 297   @@ -549,6 +549,6 @@
 }
- + \ No newline at end of file