|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbiz.c24.io.api.presentation.stream.DataReader
biz.c24.io.api.presentation.stream.BorderedCharDataReader
public class BorderedCharDataReader
Char data stream reader.
Provides the charachter stream processing. Additively it is provides the stackable borders on visible data (a.k.a. nested windows) that allows to read the limited by certain border data.
Nested Class Summary | |
---|---|
class |
BorderedCharDataReader.CharDataLocator
The location in charachter stream representation class. |
Nested classes/interfaces inherited from class biz.c24.io.api.presentation.stream.DataReader |
---|
DataReader.Locator |
Field Summary |
---|
Fields inherited from class biz.c24.io.api.presentation.stream.DataReader |
---|
count, eof, locator, pos |
Constructor Summary | |
---|---|
BorderedCharDataReader()
Default constructor. |
Method Summary | |
---|---|
void |
acquireLimit(String[] sign)
Force to re-locate the current border if it has the same sign as expected charachters. |
int |
available()
Returns the number of available charachters (taking into consideration the existing borders). |
void |
close()
Closes this reader and releases any system resources associated with it. |
protected void |
compact(int from,
int requested)
Compacts the data in the internal buffer. |
protected int |
fill(int requested)
Fills out the internal buffer by next charachters from underlied reader. |
String |
get20Characters()
Debug only method to get the upmost 20 charachters in raw data. |
String |
get20CharactersBeforeOffset(int offset)
|
int |
getColumnNumber()
Returns the column number of current location. |
InputStream |
getDataStream()
Returns the underlied incoming data stream. |
int |
getLineNumber()
Returns the line number of current location. |
String |
getNextToken(String delimiter)
Get the next token delimited from the stream. |
int |
getOffset()
Returns the current offset within charachter data. |
int |
indexOf(char delimiter,
int from)
Find out the position of next occurrence the delimiter from specified pos. |
int |
indexOf(String str)
Find out the position of next occurence the str. |
int |
indexOf(String str,
int from)
Find out the position of next occurence the str from specified pos. |
void |
initialize(Reader in)
Initialization by specified data stream. |
String |
lookUp(int length)
Lookups the next length charachters in incoming data without updating the current location. |
String |
lookUpmost(int length)
Deprecated. |
String |
lookUpmostWithoutPad(String pad,
int length)
Deprecated. |
String |
read(char delimiter)
Only looking for a single character delimiter so no point in using an expensive String |
String |
read(int length)
Reads the next length charachters in incoming data. |
boolean |
ready()
Checks whether coming data on next read or not. |
void |
setLimit(String[] sign,
boolean isOptional)
Sets the additional border on character stream. |
int |
skipIf(String str,
int length)
Do skip the length charachters while they equals the specified str. |
boolean |
startsFrom(String str)
Check wether the charachter stream equals to specified str. |
boolean |
startsFrom(String str,
boolean caseSensitive)
Check wether the charachter stream equals to specified str. |
void |
trimSpaces(String[] wrappers)
Trims the white spaces between wrapped elements |
void |
unsetLimit()
Removes the current border and forces to re-locate next one. |
Methods inherited from class biz.c24.io.api.presentation.stream.DataReader |
---|
ensureOpen, eof, getLocator, getLookAhead, getLookBehind, mark, rollback, setLookAhead, setLookBehind, skip, updateLocator |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BorderedCharDataReader()
Method Detail |
---|
public final void initialize(Reader in) throws IOException
in
- The underlied charachter data reader.
IOException
- If I/O errors occured.public int getOffset()
public boolean ready() throws IOException
IOException
- If an I/O error occurs.public String read(int length) throws IOException
length
- The number of chars that need to read.
string
or null - if number of available charachters
less than expected or not at all.
IOException
- If an I/O error occurs.public String read(char delimiter) throws IOException
delimiter
-
IOException
public String lookUp(int length) throws IOException
length
- The number of chars that need to read.
string
or null - if number of available charachters
less than expected or not at all.
IOException
- If I/O errors occured.public void trimSpaces(String[] wrappers)
wrappers
- The Wrappers used by the text to locate elementspublic String lookUpmost(int length) throws IOException
length
- The number of chars that need to read.
string
or empty string - if number of available charachters
less than expected or not at all.
IOException
- If an I/O error occurs.public String lookUpmostWithoutPad(String pad, int length) throws IOException
pad
- The padding charachters that may happend before and after the actual data.length
- The number of chars that need to read.
string
or empty string - if number of available charachters
less than expected or not at all.
IOException
- If an I/O error occurs.public int skipIf(String str, int length) throws IOException
str
- The string against which the skipped charachters will be compared.length
- The number of charachters that needed be skipped.
IOException
- If an I/O error occurs.public String get20Characters()
public String get20CharactersBeforeOffset(int offset)
public String getNextToken(String delimiter) throws IOException
IOException
public int indexOf(String str) throws IOException
str
- The string against which charachters need be compared.
IOException
- if I/O error occured.public int indexOf(String str, int from) throws IOException
str
- The string against which charachters need be compared.from
- The position in charachters from which search should start.
IOException
- if I/O error occured.public int indexOf(char delimiter, int from) throws IOException
delimiter
- The string against which characters need be compared.from
- The position in characters from which search should start.
IOException
- if I/O error occurred.public void setLimit(String[] sign, boolean isOptional) throws IOException
read
/look up
operations. Note, that adding new border will affect on all existing but not move out them, they will stay actual
but will be re-located if needed.
sign
- The set of signs that represents this border.isOptional
- whether this border required or not.
IOException
- if I/O error occured.public void acquireLimit(String[] sign) throws IOException
sign
- The set of signs that is expected in charachtyer stream.
IOException
- If an I/O error occurs.public void unsetLimit() throws IOException
IOException
- If an I/O error occurs.public boolean startsFrom(String str) throws IOException
str
- The charachter sequence against that the equality is checked.
IOException
- If an I/O error occurs.public boolean startsFrom(String str, boolean caseSensitive) throws IOException
str
- The charachter sequence against that the equality is checked.caseSensitive
- should be considered the case sensitivity or not.
IOException
- If an I/O error occurs.public int available()
available
in class DataReader
FilterInputStream.in
public void close() throws IOException
close
in class DataReader
IOException
- if an I/O error occurs.public final InputStream getDataStream()
getDataStream
in class DataReader
incoming data stream
.
UnsupportedOperationException
- If implementation doesn't provided that ability.protected final int fill(int requested) throws IOException
fill
in class DataReader
requested
- the number of charachters that were requested.
IOException
- If unexpected I/O error happends.protected final void compact(int from, int requested) throws IOException
compact
in class DataReader
from
- The pointer in buffer up to which data may be marked as invalidated.requested
- the number of charachters that should stay in buffer in any way.
IOException
- If unexpected I/O error happends.public final int getLineNumber()
public final int getColumnNumber()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |