Skip to content

Commit 516b82b

Browse files
committed
Made all public methods in CharBuffer and ExtendedBufferedReader package private
git-svn-id: https://svn.apache.org/repos/asf/commons/sandbox/csv/trunk@1297719 13f79535-47bb-0310-9956-ffa450edef68
1 parent 9dd3dda commit 516b82b

2 files changed

Lines changed: 21 additions & 25 deletions

File tree

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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ class CharBuffer {
3838
/**
3939
* Creates a new CharBuffer with an initial capacity of 32 characters.
4040
*/
41-
public CharBuffer() {
41+
CharBuffer() {
4242
this(32);
4343
}
4444

4545
/**
4646
* Creates a new CharBuffer with an initial capacity
4747
* of <code>length</code> characters.
4848
*/
49-
public CharBuffer(final int length) {
49+
CharBuffer(final int length) {
5050
if (length == 0) {
5151
throw new IllegalArgumentException("Can't create an empty CharBuffer");
5252
}
@@ -56,7 +56,7 @@ public CharBuffer(final int length) {
5656
/**
5757
* Empties the buffer. The capacity still remains the same, so no memory is freed.
5858
*/
59-
public void clear() {
59+
void clear() {
6060
length = 0;
6161
}
6262

@@ -65,7 +65,7 @@ public void clear() {
6565
*
6666
* @return the number of characters
6767
*/
68-
public int length() {
68+
int length() {
6969
return length;
7070
}
7171

@@ -74,7 +74,7 @@ public int length() {
7474
*
7575
* @return the maximum number of characters that can be stored in this buffer without resizing it.
7676
*/
77-
public int capacity() {
77+
int capacity() {
7878
return c.length;
7979
}
8080

@@ -84,7 +84,7 @@ public int capacity() {
8484
*
8585
* @param cb the CharBuffer to append or null
8686
*/
87-
public void append(final CharBuffer cb) {
87+
void append(final CharBuffer cb) {
8888
if (cb == null) {
8989
return;
9090
}
@@ -99,7 +99,7 @@ public void append(final CharBuffer cb) {
9999
*
100100
* @param s the String to append or null
101101
*/
102-
public void append(final String s) {
102+
void append(final String s) {
103103
if (s == null) {
104104
return;
105105
}
@@ -112,7 +112,7 @@ public void append(final String s) {
112112
*
113113
* @param data the char[] to append or null
114114
*/
115-
public void append(final char[] data) {
115+
void append(final char[] data) {
116116
if (data == null) {
117117
return;
118118
}
@@ -127,7 +127,7 @@ public void append(final char[] data) {
127127
*
128128
* @param data the char to append
129129
*/
130-
public void append(final char data) {
130+
void append(final char data) {
131131
provideCapacity(length + 1);
132132
c[length] = data;
133133
length++;
@@ -137,7 +137,7 @@ public void append(final char data) {
137137
* Shrinks the capacity of the buffer to the current length if necessary.
138138
* This method involves copying the data once!
139139
*/
140-
public void shrink() {
140+
void shrink() {
141141
if (c.length == length) {
142142
return;
143143
}
@@ -149,7 +149,7 @@ public void shrink() {
149149
/**
150150
* Removes trailing whitespace.
151151
*/
152-
public void trimTrailingWhitespace() {
152+
void trimTrailingWhitespace() {
153153
while (length > 0 && Character.isWhitespace(c[length - 1])) {
154154
length--;
155155
}
@@ -164,7 +164,7 @@ public void trimTrailingWhitespace() {
164164
*
165165
* @return
166166
*/
167-
public char[] getCharacters() {
167+
char[] getCharacters() {
168168
if (c.length == length) {
169169
return c;
170170
}
@@ -176,7 +176,7 @@ public char[] getCharacters() {
176176
/**
177177
* Returns the character at the specified position.
178178
*/
179-
public char charAt(int pos) {
179+
char charAt(int pos) {
180180
return c[pos];
181181
}
182182

@@ -195,7 +195,7 @@ public String toString() {
195195
*
196196
* @param capacity
197197
*/
198-
public void provideCapacity(final int capacity) {
198+
void provideCapacity(final int capacity) {
199199
if (c.length >= capacity) {
200200
return;
201201
}

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

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@
3434
class ExtendedBufferedReader extends BufferedReader {
3535

3636
/** The end of stream symbol */
37-
public static final int END_OF_STREAM = -1;
37+
static final int END_OF_STREAM = -1;
3838

3939
/** Undefined state for the lookahead char */
40-
public static final int UNDEFINED = -2;
40+
static final int UNDEFINED = -2;
4141

4242
/** The lookahead chars */
4343
private int lookaheadChar = UNDEFINED;
@@ -53,7 +53,7 @@ class ExtendedBufferedReader extends BufferedReader {
5353
/**
5454
* Created extended buffered reader using default buffer-size
5555
*/
56-
public ExtendedBufferedReader(Reader r) {
56+
ExtendedBufferedReader(Reader r) {
5757
super(r);
5858
/* note uh: do not fetch the first char here,
5959
* because this might block the method!
@@ -87,7 +87,7 @@ public int read() throws IOException {
8787
*
8888
* @return the last read char or UNDEFINED
8989
*/
90-
public int readAgain() {
90+
int readAgain() {
9191
return lastChar;
9292
}
9393

@@ -198,7 +198,7 @@ public long skip(long n) throws IllegalArgumentException, IOException {
198198
*
199199
* @return the next char (without consuming it) or END_OF_STREAM
200200
*/
201-
public int lookAhead() throws IOException {
201+
int lookAhead() throws IOException {
202202
if (lookaheadChar == UNDEFINED) {
203203
lookaheadChar = super.read();
204204
}
@@ -211,12 +211,8 @@ public int lookAhead() throws IOException {
211211
*
212212
* @return the current-line-number (or -1)
213213
*/
214-
public int getLineNumber() {
215-
if (lineCounter > -1) {
216-
return lineCounter;
217-
} else {
218-
return -1;
219-
}
214+
int getLineNumber() {
215+
return lineCounter > -1 ? lineCounter : -1;
220216
}
221217

222218
/**

0 commit comments

Comments
 (0)