Skip to content

Commit fcc0d15

Browse files
committed
- Remove trailing spaces.
- Add missing final keywords. git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1509069 13f79535-47bb-0310-9956-ffa450edef68
1 parent 316a51f commit fcc0d15

14 files changed

Lines changed: 75 additions & 76 deletions

src/main/java/org/apache/commons/csv/CSVFormat.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
public class CSVFormat implements Serializable {
5454

5555
private static final long serialVersionUID = 1L;
56-
56+
5757
/**
5858
* Returns true if the given character is a line break character.
5959
*
@@ -66,7 +66,7 @@ public class CSVFormat implements Serializable {
6666
static boolean isLineBreak(final Character c) {
6767
return c != null && isLineBreak(c.charValue());
6868
}
69-
69+
7070
private final char delimiter;
7171
private final Character quoteChar;
7272
private final Quote quotePolicy;
@@ -324,8 +324,8 @@ public Character getEscape() {
324324
}
325325

326326
/**
327-
* Returns a copy of the header array.
328-
*
327+
* Returns a copy of the header array.
328+
*
329329
* @return a copy of the header array
330330
*/
331331
public String[] getHeader() {
@@ -362,7 +362,7 @@ public boolean getIgnoreSurroundingSpaces() {
362362
* <li>
363363
* <strong>Writing:</strong> Writes {@code null} as the given {@code nullString} when writing records.</li>
364364
* </ul>
365-
*
365+
*
366366
* @return the String to convert to and from {@code null}. No substitution occurs if {@code null}
367367
*/
368368
public String getNullString() {
@@ -454,11 +454,11 @@ public boolean isQuoting() {
454454

455455
/**
456456
* Parses the specified content.
457-
*
457+
*
458458
* <p>
459459
* See also the various static parse methods on {@link CSVParser}.
460460
* </p>
461-
*
461+
*
462462
* @param in
463463
* the input stream
464464
* @return a parser over a stream of {@link #CSVRecord}s.
@@ -528,9 +528,9 @@ void validate() throws IllegalStateException {
528528
if (escape == null && quotePolicy == Quote.NONE) {
529529
throw new IllegalStateException("No quotes mode set but no escape character is set");
530530
}
531-
531+
532532
if (header != null) {
533-
Set<String> set = new HashSet<String>(header.length);
533+
final Set<String> set = new HashSet<String>(header.length);
534534
set.addAll(Arrays.asList(header));
535535
if (set.size() != header.length) {
536536
throw new IllegalStateException("The header contains duplicate names: " + Arrays.toString(header));
@@ -621,18 +621,18 @@ public CSVFormat withEscape(final Character escape) {
621621

622622
/**
623623
* Sets the header of the format. The header can either be parsed automatically from the input file with:
624-
*
624+
*
625625
* <pre>
626626
* CSVFormat format = aformat.withHeader();</pre>
627-
*
627+
*
628628
* or specified manually with:
629-
*
629+
*
630630
* <pre>
631631
* CSVFormat format = aformat.withHeader(&quot;name&quot;, &quot;email&quot;, &quot;phone&quot;);</pre>
632-
*
632+
*
633633
* @param header
634634
* the header, <tt>null</tt> if disabled, empty if parsed automatically, user specified otherwise.
635-
*
635+
*
636636
* @return A new CSVFormat that is equal to this but with the specified header
637637
* @see #withSkipHeaderRecord(boolean)
638638
*/

src/main/java/org/apache/commons/csv/CSVLexer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ Token nextToken(final Token token) throws IOException {
8686
}
8787

8888
if (isStartOfLine(lastChar) && isCommentStart(c)) {
89-
String line = in.readLine();
89+
final String line = in.readLine();
9090
if (line == null) {
9191
token.type = EOF;
9292
// don't set token.isReady here because no content
93-
return token;
93+
return token;
9494
}
9595
final String comment = line.trim();
9696
token.content.append(comment);

src/main/java/org/apache/commons/csv/CSVParser.java

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@
3737

3838
/**
3939
* Parses CSV files according to the specified configuration.
40-
*
40+
*
4141
* Because CSV appears in many different dialects, the parser supports many configuration settings by allowing the
4242
* specification of a {@link CSVFormat}.
43-
*
43+
*
4444
* <p>
4545
* To parse a CSV input with tabs as separators, '"' (double-quote) as an optional value encapsulator, and comments
4646
* starting with '#', you write:
4747
* </p>
48-
*
48+
*
4949
* <pre>
5050
* Reader in = new StringReader(&quot;a\tb\nc\td&quot;);
5151
* Iterable&lt;CSVRecord&gt; parser = CSVFormat.DEFAULT
@@ -56,11 +56,11 @@
5656
* ...
5757
* }
5858
* </pre>
59-
*
59+
*
6060
* <p>
6161
* To parse CSV input in a given format like Excel, you write:
6262
* </p>
63-
*
63+
*
6464
* <pre>
6565
* Reader in = new StringReader("a;b\nc;d");
6666
* Iterable&lt;CSVRecord&gt; parser = CSVFormat.EXCEL.parse(in);
@@ -71,7 +71,7 @@
7171
* <p>
7272
* You may also get a List of records:
7373
* </p>
74-
*
74+
*
7575
* <pre>
7676
* Reader in = new StringReader(&quot;a;b\nc;d&quot;);
7777
* CSVParser parser = new CSVParser(in, CSVFormat.EXCEL);
@@ -83,18 +83,18 @@
8383
* <p>
8484
* Internal parser state is completely covered by the format and the reader-state.
8585
* </p>
86-
*
86+
*
8787
* <p>
8888
* see <a href="package-summary.html">package documentation</a> for more details
8989
* </p>
90-
*
90+
*
9191
* @version $Id$
9292
*/
9393
public class CSVParser implements Iterable<CSVRecord>, Closeable {
9494

9595
/**
9696
* Creates a parser for the given {@link File}.
97-
*
97+
*
9898
* @param file
9999
* a CSV file
100100
* @param format
@@ -109,11 +109,11 @@ public static CSVParser parseFile(File file, final CSVFormat format) throws IOEx
109109

110110
/**
111111
* Creates a parser for the given resource.
112-
*
112+
*
113113
* <p>
114114
* If you do not read all records from the given source, you should call {@link #close()} on the parser.
115115
* </p>
116-
*
116+
*
117117
* @param resource
118118
* a resource path
119119
* @param charset
@@ -128,7 +128,7 @@ public static CSVParser parseFile(File file, final CSVFormat format) throws IOEx
128128
*/
129129
public static CSVParser parseResource(String resource, Charset charset, ClassLoader classLoader,
130130
final CSVFormat format) throws IOException {
131-
URL url = classLoader.getResource(resource);
131+
final URL url = classLoader.getResource(resource);
132132
if (url == null) {
133133
throw new IllegalArgumentException("Resource cannot be found: " + resource);
134134
}
@@ -137,11 +137,11 @@ public static CSVParser parseResource(String resource, Charset charset, ClassLoa
137137

138138
/**
139139
* Creates a parser for the given resource.
140-
*
140+
*
141141
* <p>
142142
* If you do not read all records from the given source, you should call {@link #close()} on the parser.
143143
* </p>
144-
*
144+
*
145145
* @param resource
146146
* a resource path
147147
* @param charset
@@ -153,7 +153,7 @@ public static CSVParser parseResource(String resource, Charset charset, ClassLoa
153153
* If an I/O error occurs
154154
*/
155155
public static CSVParser parseResource(String resource, Charset charset, final CSVFormat format) throws IOException {
156-
URL url = ClassLoader.getSystemResource(resource);
156+
final URL url = ClassLoader.getSystemResource(resource);
157157
if (url == null) {
158158
throw new IllegalArgumentException("System resource cannot be found: " + resource);
159159
}
@@ -162,7 +162,7 @@ public static CSVParser parseResource(String resource, Charset charset, final CS
162162

163163
/**
164164
* Creates a parser for the given {@link String} using the default format {@link CSVFormat#DEFAULT}.
165-
*
165+
*
166166
* @param string
167167
* a CSV string
168168
* @return a new parser
@@ -175,7 +175,7 @@ public static CSVParser parseString(String string) throws IOException {
175175

176176
/**
177177
* Creates a parser for the given {@link String}.
178-
*
178+
*
179179
* @param string
180180
* a CSV string
181181
* @param format
@@ -190,12 +190,12 @@ public static CSVParser parseString(String string, final CSVFormat format) throw
190190

191191
/**
192192
* Creates a parser for the given URL.
193-
*
193+
*
194194
* <p>
195195
* If you do not read all records from the given {@code url}, you should call {@link #close()} on the parser, unless
196196
* you close the {@code url}.
197197
* </p>
198-
*
198+
*
199199
* @param url
200200
* a URL
201201
* @param charset
@@ -230,12 +230,12 @@ public static CSVParser parseURL(URL url, Charset charset, final CSVFormat forma
230230

231231
/**
232232
* CSV parser using the default format {@link CSVFormat#DEFAULT}.
233-
*
233+
*
234234
* <p>
235235
* If you do not read all records from the given {@code reader}, you should call {@link #close()} on the parser,
236236
* unless you close the {@code reader}.
237237
* </p>
238-
*
238+
*
239239
* @param input
240240
* a Reader containing "csv-formatted" input
241241
* @throws IllegalArgumentException
@@ -249,12 +249,12 @@ public CSVParser(final Reader input) throws IOException {
249249

250250
/**
251251
* Customized CSV parser using the given {@link CSVFormat}
252-
*
252+
*
253253
* <p>
254254
* If you do not read all records from the given {@code reader}, you should call {@link #close()} on the parser,
255255
* unless you close the {@code reader}.
256256
* </p>
257-
*
257+
*
258258
* @param reader
259259
* a Reader containing CSV-formatted input
260260
* @param format
@@ -283,7 +283,7 @@ private void addRecordValue() {
283283

284284
/**
285285
* Closes resources.
286-
*
286+
*
287287
* @throws IOException
288288
* If an I/O error occurs
289289
*/
@@ -297,7 +297,7 @@ public void close() throws IOException {
297297
* Returns the current line number in the input stream.
298298
* <p/>
299299
* ATTENTION: If your CSV input has multi-line values, the returned number does not correspond to the record number.
300-
*
300+
*
301301
* @return current line number
302302
*/
303303
public long getCurrentLineNumber() {
@@ -308,7 +308,7 @@ public long getCurrentLineNumber() {
308308
* Returns a copy of the header map that iterates in column order.
309309
* <p>
310310
* The map keys are column names. The map values are 0-based indices.
311-
*
311+
*
312312
* @return a copy of the header map that iterates in column order.
313313
*/
314314
public Map<String, Integer> getHeaderMap() {
@@ -319,7 +319,7 @@ public Map<String, Integer> getHeaderMap() {
319319
* Returns the current record number in the input stream.
320320
* <p/>
321321
* ATTENTION: If your CSV input has multi-line values, the returned number does not correspond to the line number.
322-
*
322+
*
323323
* @return current line number
324324
*/
325325
public long getRecordNumber() {
@@ -331,7 +331,7 @@ public long getRecordNumber() {
331331
* entries.
332332
* <p/>
333333
* The returned content starts at the current parse-position in the stream.
334-
*
334+
*
335335
* @return list of {@link CSVRecord} entries, may be empty
336336
* @throws IOException
337337
* on parse error or input read-failure
@@ -350,7 +350,7 @@ public List<CSVRecord> getRecords() throws IOException {
350350
*/
351351
private Map<String, Integer> initializeHeader() throws IOException {
352352
Map<String, Integer> hdrMap = null;
353-
String[] formatHeader = this.format.getHeader();
353+
final String[] formatHeader = this.format.getHeader();
354354
if (formatHeader != null) {
355355
hdrMap = new LinkedHashMap<String, Integer>();
356356

@@ -436,7 +436,7 @@ public void remove() {
436436

437437
/**
438438
* Parses the next record from the current point in the stream.
439-
*
439+
*
440440
* @return the record as an array of values, or <tt>null</tt> if the end of the stream has been reached
441441
* @throws IOException
442442
* on parse error or input read-failure

src/main/java/org/apache/commons/csv/Constants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ final class Constants {
4949

5050
/** According to RFC 4180, line breaks are delimited by CRLF */
5151
static final String CRLF = "\r\n";
52-
52+
5353
/**
5454
* Unicode line separator.
5555
*/

src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ final class ExtendedBufferedReader extends BufferedReader {
4141

4242
/** The count of EOLs (CR/LF/CRLF) seen so far */
4343
private long eolCounter = 0;
44-
44+
4545
private boolean closed;
4646

4747
/**
@@ -163,7 +163,7 @@ public boolean isClosed() {
163163

164164
/**
165165
* Closes the stream.
166-
*
166+
*
167167
* @throws IOException
168168
* If an I/O error occurs
169169
*/

src/main/java/org/apache/commons/csv/Lexer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ boolean readEndOfLine(int ch) throws IOException {
151151
boolean isClosed() {
152152
return in.isClosed();
153153
}
154-
154+
155155
/**
156156
* @return true if the given char is a whitespace character
157157
*/
@@ -201,7 +201,7 @@ private boolean isMetaChar(final int ch) {
201201

202202
/**
203203
* Closes resources.
204-
*
204+
*
205205
* @throws IOException
206206
* If an I/O error occurs
207207
*/

src/main/java/org/apache/commons/csv/Token.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void reset() {
6565

6666
/**
6767
* Eases IDE debugging.
68-
*
68+
*
6969
* @return a string helpful for debugging.
7070
*/
7171
@Override

0 commit comments

Comments
 (0)