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
This commit is contained in:
parent
9dd3dda09f
commit
516b82b471
|
@ -38,7 +38,7 @@ class CharBuffer {
|
||||||
/**
|
/**
|
||||||
* Creates a new CharBuffer with an initial capacity of 32 characters.
|
* Creates a new CharBuffer with an initial capacity of 32 characters.
|
||||||
*/
|
*/
|
||||||
public CharBuffer() {
|
CharBuffer() {
|
||||||
this(32);
|
this(32);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ class CharBuffer {
|
||||||
* Creates a new CharBuffer with an initial capacity
|
* Creates a new CharBuffer with an initial capacity
|
||||||
* of <code>length</code> characters.
|
* of <code>length</code> characters.
|
||||||
*/
|
*/
|
||||||
public CharBuffer(final int length) {
|
CharBuffer(final int length) {
|
||||||
if (length == 0) {
|
if (length == 0) {
|
||||||
throw new IllegalArgumentException("Can't create an empty CharBuffer");
|
throw new IllegalArgumentException("Can't create an empty CharBuffer");
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ class CharBuffer {
|
||||||
/**
|
/**
|
||||||
* Empties the buffer. The capacity still remains the same, so no memory is freed.
|
* Empties the buffer. The capacity still remains the same, so no memory is freed.
|
||||||
*/
|
*/
|
||||||
public void clear() {
|
void clear() {
|
||||||
length = 0;
|
length = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ class CharBuffer {
|
||||||
*
|
*
|
||||||
* @return the number of characters
|
* @return the number of characters
|
||||||
*/
|
*/
|
||||||
public int length() {
|
int length() {
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ class CharBuffer {
|
||||||
*
|
*
|
||||||
* @return the maximum number of characters that can be stored in this buffer without resizing it.
|
* @return the maximum number of characters that can be stored in this buffer without resizing it.
|
||||||
*/
|
*/
|
||||||
public int capacity() {
|
int capacity() {
|
||||||
return c.length;
|
return c.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ class CharBuffer {
|
||||||
*
|
*
|
||||||
* @param cb the CharBuffer to append or null
|
* @param cb the CharBuffer to append or null
|
||||||
*/
|
*/
|
||||||
public void append(final CharBuffer cb) {
|
void append(final CharBuffer cb) {
|
||||||
if (cb == null) {
|
if (cb == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ class CharBuffer {
|
||||||
*
|
*
|
||||||
* @param s the String to append or null
|
* @param s the String to append or null
|
||||||
*/
|
*/
|
||||||
public void append(final String s) {
|
void append(final String s) {
|
||||||
if (s == null) {
|
if (s == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ class CharBuffer {
|
||||||
*
|
*
|
||||||
* @param data the char[] to append or null
|
* @param data the char[] to append or null
|
||||||
*/
|
*/
|
||||||
public void append(final char[] data) {
|
void append(final char[] data) {
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ class CharBuffer {
|
||||||
*
|
*
|
||||||
* @param data the char to append
|
* @param data the char to append
|
||||||
*/
|
*/
|
||||||
public void append(final char data) {
|
void append(final char data) {
|
||||||
provideCapacity(length + 1);
|
provideCapacity(length + 1);
|
||||||
c[length] = data;
|
c[length] = data;
|
||||||
length++;
|
length++;
|
||||||
|
@ -137,7 +137,7 @@ class CharBuffer {
|
||||||
* Shrinks the capacity of the buffer to the current length if necessary.
|
* Shrinks the capacity of the buffer to the current length if necessary.
|
||||||
* This method involves copying the data once!
|
* This method involves copying the data once!
|
||||||
*/
|
*/
|
||||||
public void shrink() {
|
void shrink() {
|
||||||
if (c.length == length) {
|
if (c.length == length) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,7 @@ class CharBuffer {
|
||||||
/**
|
/**
|
||||||
* Removes trailing whitespace.
|
* Removes trailing whitespace.
|
||||||
*/
|
*/
|
||||||
public void trimTrailingWhitespace() {
|
void trimTrailingWhitespace() {
|
||||||
while (length > 0 && Character.isWhitespace(c[length - 1])) {
|
while (length > 0 && Character.isWhitespace(c[length - 1])) {
|
||||||
length--;
|
length--;
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,7 @@ class CharBuffer {
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public char[] getCharacters() {
|
char[] getCharacters() {
|
||||||
if (c.length == length) {
|
if (c.length == length) {
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,7 @@ class CharBuffer {
|
||||||
/**
|
/**
|
||||||
* Returns the character at the specified position.
|
* Returns the character at the specified position.
|
||||||
*/
|
*/
|
||||||
public char charAt(int pos) {
|
char charAt(int pos) {
|
||||||
return c[pos];
|
return c[pos];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ class CharBuffer {
|
||||||
*
|
*
|
||||||
* @param capacity
|
* @param capacity
|
||||||
*/
|
*/
|
||||||
public void provideCapacity(final int capacity) {
|
void provideCapacity(final int capacity) {
|
||||||
if (c.length >= capacity) {
|
if (c.length >= capacity) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,10 +34,10 @@ import java.io.Reader;
|
||||||
class ExtendedBufferedReader extends BufferedReader {
|
class ExtendedBufferedReader extends BufferedReader {
|
||||||
|
|
||||||
/** The end of stream symbol */
|
/** The end of stream symbol */
|
||||||
public static final int END_OF_STREAM = -1;
|
static final int END_OF_STREAM = -1;
|
||||||
|
|
||||||
/** Undefined state for the lookahead char */
|
/** Undefined state for the lookahead char */
|
||||||
public static final int UNDEFINED = -2;
|
static final int UNDEFINED = -2;
|
||||||
|
|
||||||
/** The lookahead chars */
|
/** The lookahead chars */
|
||||||
private int lookaheadChar = UNDEFINED;
|
private int lookaheadChar = UNDEFINED;
|
||||||
|
@ -53,7 +53,7 @@ class ExtendedBufferedReader extends BufferedReader {
|
||||||
/**
|
/**
|
||||||
* Created extended buffered reader using default buffer-size
|
* Created extended buffered reader using default buffer-size
|
||||||
*/
|
*/
|
||||||
public ExtendedBufferedReader(Reader r) {
|
ExtendedBufferedReader(Reader r) {
|
||||||
super(r);
|
super(r);
|
||||||
/* note uh: do not fetch the first char here,
|
/* note uh: do not fetch the first char here,
|
||||||
* because this might block the method!
|
* because this might block the method!
|
||||||
|
@ -87,7 +87,7 @@ class ExtendedBufferedReader extends BufferedReader {
|
||||||
*
|
*
|
||||||
* @return the last read char or UNDEFINED
|
* @return the last read char or UNDEFINED
|
||||||
*/
|
*/
|
||||||
public int readAgain() {
|
int readAgain() {
|
||||||
return lastChar;
|
return lastChar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@ class ExtendedBufferedReader extends BufferedReader {
|
||||||
*
|
*
|
||||||
* @return the next char (without consuming it) or END_OF_STREAM
|
* @return the next char (without consuming it) or END_OF_STREAM
|
||||||
*/
|
*/
|
||||||
public int lookAhead() throws IOException {
|
int lookAhead() throws IOException {
|
||||||
if (lookaheadChar == UNDEFINED) {
|
if (lookaheadChar == UNDEFINED) {
|
||||||
lookaheadChar = super.read();
|
lookaheadChar = super.read();
|
||||||
}
|
}
|
||||||
|
@ -211,12 +211,8 @@ class ExtendedBufferedReader extends BufferedReader {
|
||||||
*
|
*
|
||||||
* @return the current-line-number (or -1)
|
* @return the current-line-number (or -1)
|
||||||
*/
|
*/
|
||||||
public int getLineNumber() {
|
int getLineNumber() {
|
||||||
if (lineCounter > -1) {
|
return lineCounter > -1 ? lineCounter : -1;
|
||||||
return lineCounter;
|
|
||||||
} else {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue