Methods Summary |
---|
public void | close()Close resets the file back to the start and removes any marked position.
idx = 0;
mark = 0;
|
public void | mark(int readAheadLimit)Mark the current position.
mark = idx;
|
public boolean | markSupported()Mark is supported (returns true).
return true;
|
public int | read()Read a single character.
if (idx >= charSequence.length()) {
return -1;
} else {
return charSequence.charAt(idx++);
}
|
public int | read(char[] array, int offset, int length)Read the sepcified number of characters into the array.
if (idx >= charSequence.length()) {
return -1;
}
if (array == null) {
throw new NullPointerException("Character array is missing");
}
if (length < 0 || (offset + length) > array.length) {
throw new IndexOutOfBoundsException("Array Size=" + array.length +
", offset=" + offset + ", length=" + length);
}
int count = 0;
for (int i = 0; i < length; i++) {
int c = read();
if (c == -1) {
return count;
}
array[offset + i] = (char)c;
count++;
}
return count;
|
public void | reset()Reset the reader to the last marked position (or the beginning if
mark has not been called).
idx = mark;
|
public long | skip(long n)Skip the specified number of characters.
if (n < 0) {
throw new IllegalArgumentException(
"Number of characters to skip is less than zero: " + n);
}
if (idx >= charSequence.length()) {
return -1;
}
int dest = (int)Math.min(charSequence.length(), (idx + n));
int count = dest - idx;
idx = dest;
return count;
|
public java.lang.String | toString()Return a String representation of the underlying
character sequence.
return charSequence.toString();
|