|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectolg.csv.base.csv.CharSearchReader
public class CharSearchReader
This class provides methods based on the character search and hides the original stream reading.
| Field Summary | |
|---|---|
static int |
BUF_SIZE
Reader Buffer size default size. |
private char[] |
cbuf
the char buffer. |
private int |
currentBufSize
Current buffer size. |
private boolean |
eof
Indicates if end of file is reached. |
private static org.slf4j.Logger |
LOGGER
the class logger. |
private int |
maxBufSize
reader buffer size. |
private int |
offset
buffer offset. |
private BufferedReader |
reader
The input reader. |
private StringBuilder |
store
Retains the characters previously read into the buffer. |
| Constructor Summary | |
|---|---|
|
CharSearchReader(InputStream reader,
String charset)
|
protected |
CharSearchReader(InputStream reader,
String charset,
int bufSize)
|
| Method Summary | |
|---|---|
char |
charAt(int index)
Returns the char at an index. |
void |
close()
|
boolean |
exists(int index)
Indicates if a char exists at an index in this stream. |
int |
find(char... args)
Finds the first index of the first character found. |
int |
findNextAtIndex(int begin,
char... args)
Finds the first index of the first character found starting at a specific index in the stream. |
private int |
findNextAtIndexFromBegin(int begin,
char... args)
Finds the first index of the first character found starting at a specific index in the stream. |
private int |
findNextInBufAtIndex(int begin,
char... args)
Finds the first index of the first character found starting at a specific index in the buf. |
int |
getSize()
Returns the current size of the stream. |
boolean |
isEof()
Indicates if end of file is reached. |
private void |
loadBuf()
Loads the next sequence. |
private void |
loadNextSequence()
Stores the current sequence and loads the next sequence. |
void |
skip(int nb)
Skips characters in the stream. |
String |
substring(int begin,
int end)
Returns a new String that contains a subsequence of characters currently contained in the stream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final org.slf4j.Logger LOGGER
public static final int BUF_SIZE
private int currentBufSize
private BufferedReader reader
private boolean eof
private int offset
private int maxBufSize
private final char[] cbuf
private final StringBuilder store
| Constructor Detail |
|---|
public CharSearchReader(InputStream reader,
String charset)
throws IOException
reader - the input stream.charset - the charset name.
IOException - If an I/O error occurs or If the named charset is not
supported
protected CharSearchReader(InputStream reader,
String charset,
int bufSize)
throws IOException
reader - the input stream.charset - the charset name.bufSize - the max buf size.
IOException - If an I/O error occurs or If the named charset is not
supported| Method Detail |
|---|
public boolean isEof()
public char charAt(int index)
throws IOException
index - the index.
IOException - when the index is not reachable or If an I/O error occurspublic boolean exists(int index)
index - the index
public int find(char... args)
throws IOException
args - the chars to search.
IOException - the eof is reached without find chars or if an I/O error
occurs.
public int findNextAtIndex(int begin,
char... args)
throws IOException
begin - the index to start the search from.args - the chars to search.
IOException - when the begin index is not reachable or the eof is reached
without find chars.public void skip(int nb)
nb - The number of characters to skip
public String substring(int begin,
int end)
begin - The beginning index, inclusive.end - The ending index, exclusive.
public int getSize()
public void close()
close in interface Closeable
private int findNextInBufAtIndex(int begin,
char... args)
begin - the index to start the search from.args - the chars to search.
private int findNextAtIndexFromBegin(int begin,
char... args)
throws IOException
begin - the index to start the search from.args - the chars to search.
IOException - the eof is reached without find chars or if an I/O error
occurs.
private void loadNextSequence()
throws IOException
IOException - if end of line is reached on loading the next sequence or an
I/O error occurs
private void loadBuf()
throws IOException
IOException - If an I/O error occurs
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||