Skip to content

Commit 8387f79

Browse files
authored
Fix comments (#15)
* Fix comments
1 parent 27511be commit 8387f79

File tree

5 files changed

+25
-6
lines changed

5 files changed

+25
-6
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public static class Builder extends AbstractStreamBuilder<CSVParser, Builder> {
153153
private CSVFormat format;
154154
private long characterOffset;
155155
private long recordNumber = 1;
156-
private boolean enableByteTracking = false;
156+
private boolean enableByteTracking;
157157

158158
/**
159159
* Constructs a new instance.
@@ -201,6 +201,12 @@ public Builder setRecordNumber(final long recordNumber) {
201201
return asThis();
202202
}
203203

204+
/**
205+
* Sets whether to enable byte tracking for the parser.
206+
*
207+
* @param enableByteTracking {@code true} to enable byte tracking; {@code false} to disable it.
208+
* @return this instance.
209+
*/
204210
public Builder setEnableByteTracking(final boolean enableByteTracking) {
205211
this.enableByteTracking = enableByteTracking;
206212
return asThis();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public long getCharacterPosition() {
160160
}
161161

162162
/**
163-
* Returns the start byte of this record as a character byte in the source stream.
163+
* Gets the start byte of this record as a character byte in the source stream
164164
*
165165
* @return the start byte of this record as a character byte in the source stream.
166166
*/

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,15 @@ final class ExtendedBufferedReader extends UnsynchronizedBufferedReader {
6767
super(reader);
6868
}
6969

70+
/**
71+
* Constructs a new instance with the specified reader, character set,
72+
* and byte tracking option. Initializes an encoder if byte tracking is enabled
73+
* and a character set is provided.
74+
*
75+
* @param reader the reader supports a look-ahead option.
76+
* @param charset the character set for encoding, or {@code null} if not applicable.
77+
* @param enableByteTracking {@code true} to enable byte tracking; {@code false} to disable it.
78+
*/
7079
ExtendedBufferedReader(final Reader reader, Charset charset, boolean enableByteTracking) {
7180
super(reader);
7281
if (charset != null && enableByteTracking) {
@@ -146,7 +155,7 @@ public int read() throws IOException {
146155
}
147156

148157
/**
149-
* In Java, the {@code char} data type is based on the original Unicode
158+
* Gets the byte length of the given character based on the the original Unicode
150159
* specification, which defined characters as fixed-width 16-bit entities.
151160
* <p>
152161
* The Unicode characters are divided into two main ranges:
@@ -166,6 +175,10 @@ public int read() throws IOException {
166175
* </ul>
167176
* </li>
168177
* </ul>
178+
*
179+
* @param current the current character to process.
180+
* @return the byte length of the character.
181+
* @throws CharacterCodingException if the character cannot be encoded.
169182
*/
170183
private long getCharBytes(int current) throws CharacterCodingException {
171184
final char cChar = (char) current;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ long getCharacterPosition() {
104104
}
105105

106106
/**
107-
* Returns the number of bytes read
107+
* Gets the number of bytes read
108108
*
109109
* @return the number of bytes read
110110
*/

src/test/java/org/apache/commons/csv/CSVParserTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ public void testGetHeaderComment_NoComment3() throws IOException {
703703

704704
@Test
705705
public void testGetRecordThreeBytesRead() throws Exception {
706-
String code = "id,date,val5,val4\n" +
706+
final String code = "id,date,val5,val4\n" +
707707
"11111111111111,'4017-09-01',きちんと節分近くには咲いてる~,v4\n" +
708708
"22222222222222,'4017-01-01',おはよう私の友人~,v4\n" +
709709
"33333333333333,'4017-01-01',きる自然の力ってすごいな~,v4\n";
@@ -740,7 +740,7 @@ public void testGetRecordThreeBytesRead() throws Exception {
740740

741741
@Test
742742
public void testGetRecordFourBytesRead() throws Exception {
743-
String code = "id,a,b,c\n" +
743+
final String code = "id,a,b,c\n" +
744744
"1,😊,🤔,😂\n" +
745745
"2,😊,🤔,😂\n" +
746746
"3,😊,🤔,😂\n";

0 commit comments

Comments
 (0)