public class StringPartScan extends StringPart
StringPart.seek(int)
functionality with several conditions
the scan methods does not search till a requested char or string but test the string
starting from the begin of the valid part. If the test is ok, the begin of the valid part
is shifted to right behind the scanned string. The result of the scanning process
may be evaluated later. Therefore it is stored in this class, for example getLastScannedIntegerNumber()
can be gotten after scan.
abcdefghijklmnopqrstuvwxyz Sample of the whole associated String -------------------- The valid part before scan ++++++++++++++ The valid part after scan ****** The successfully scanned part. xxxxx Starting next scanA scan works with the current valid part always.
sp.scanStart(); if(sp.scan("keyword").scan('=').scanIdentifier().scanOk()){ String sIdent = sp.getLastScannedString().toString(); } else if(sp.scan("other-keyword").scan(.....The following rule is valid:
scanOk()
returns false if any of the scan methods after scanStart()
or the last scanOk()
fails.
scanOk()
was invoked and the scan before that fails, the begin of the valid part
is set to that position where the scan has started before this scan sequence. It is the position
where scanStart()
was called or the last scanOk()
with return true was called.
StringPart.setIgnoreWhitespaces(boolean)
etc. are invoked before. That setting is valid for all following
scan invocations.StringPart.Iter, StringPart.Part
Modifier and Type | Field and Description |
---|---|
protected int |
beginScan
Position of scanStart() or after scanOk() as begin of next scan operations.
|
protected int |
beginScanLast
Position of last scanStart() after scanOk().
|
private int |
ixLastFloatNumber
current index of the last scanned float number. -1=nothing scanned. 0..4=valid
|
private int |
ixLastIntegerNumber
current index of the last scanned integer number. -1=nothing scanned. 0..4=valid
|
private int |
ixLastString |
protected double[] |
nLastFloatNumber
Last scanned float number
|
protected long[] |
nLastIntegerNumber
Buffer for last scanned integer numbers.
|
protected boolean[] |
nLastIntegerSign
Buffer for last scanned signs of integer numbers.
|
protected StringPart.Part[] |
sLastString
Last scanned string.
|
static java.lang.String |
sVersion
Version, history and license.
|
absPos0, bCurrentOk, begiMin, begin, beginLast, bFound, bitMode, bStartScan, content, end, endLast, endMax, mSeekBack, mSeekCheck, mSeekEnd, mSeekToLeft, mSkipOverCommentInsideText_mode, mSkipOverCommentToEol_mode, mSkipOverWhitespace_mode, sCheckNewline, sCheckWhitespaces, sCommentEnd, sCommentStart, sCommentToEol, seekBack, seekEnd, seekNormal, seekToLeft, sFile
Constructor and Description |
---|
StringPartScan() |
StringPartScan(java.lang.CharSequence src) |
StringPartScan(java.lang.CharSequence src,
int begin,
int end) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the work.
|
private java.lang.CharSequence |
getCircumScriptionToAnyChar_p(java.lang.String sCharsEnd,
boolean bOutsideQuotion) |
java.lang.CharSequence |
getCircumScriptionToAnyChar(java.lang.String sCharsEnd)
Gets a String with transliteration.
|
java.lang.CharSequence |
getCircumScriptionToAnyCharOutsideQuotion(java.lang.String sCharsEnd)
Gets a String with transliteration and skip over quotation while searchin.
|
double |
getLastScannedFloatNumber()
Returns the last scanned float number.
|
long |
getLastScannedIntegerNumber()
Returns the last scanned integer number.
|
boolean |
getLastScannedIntegerSign()
Returns the last scanned integer sign.
|
java.lang.CharSequence |
getLastScannedPart()
Returns the last scanned part between
scanOk() or scanStart() and the following positive scanOk()
Note: The StringPart.getLastPart() returns between StringPart.beginLast and the begin position. |
StringPart.Part |
getLastScannedPart(int nr)
Returns the part of the last scanning non persistently.
|
java.lang.String |
getLastScannedString()
Returns the part of the last scanning yet only from
scanIdentifier() |
boolean |
readNextContent(int minPosToRead)
Read next content from any source (usual a input stream) in an overridden form of this class.
|
StringPartScan |
scan()
Invocation of scan() for a
StringPart is the same than scanStart(). |
StringPartScan |
scan(java.lang.CharSequence sTestP)
scan next content, test the requested String.
|
StringPartScan |
scanAnyChar(java.lang.String cmp)
Scans whether one of the given characters is currently follow
|
StringPartScan |
scanChar(char cmp)
Scans whether the given char is currently follow
|
StringPartScan |
scanDigits(int radix,
int maxNrofChars,
java.lang.String separatorChars) |
StringPartScan |
scanDigits(int radix,
int maxNrofChars,
java.lang.String separatorChars,
java.lang.String[] scannedString)
Scans a positive number consisting of digits 0..9, A..Z or a..z
whereby only digits necessary for the given radix are accepted, and sepChars.
|
private boolean |
scanEntry()
Internal check on any scan routine.
|
StringPartScan |
scanFloatNumber()
Scans a float / double number.
|
StringPartScan |
scanFloatNumber(boolean cleanBuffer)
Scans a float number.
|
StringPartScan |
scanFloatNumber(char fractionalSeparator,
boolean bStrict,
java.lang.String separatorChars)
Scans a float / double number.
|
StringPartScan |
scanFractionalExponent(char fractionalSeparator,
boolean bStrict,
java.lang.String separatorChars,
long nInteger,
boolean bNegative)
Scans the fractional part of a float / double number with given integer part and sign.
|
StringPartScan |
scanFractionalNumber(long nInteger,
boolean bNegative)
Scans the fractionalPart and the exponent of a float number with '.' as first expected separator
and without additional separator characters.
|
StringPartScan |
scanHex(int maxNrofChars)
Scans a sequence of hex chars a hex number.
|
StringPartScan |
scanHex(int maxNrofChars,
java.lang.String[] scannedString)
Scans a sequence of hex chars a hex number.
|
StringPartScan |
scanHexOrDecimal(int maxNrofChars) |
StringPartScan |
scanHexOrDecimal(int maxNrofChars,
java.lang.String[] scannedString)
Scans a integer number possible as hex, or decimal number.
|
StringPartScan |
scanIdentifier()
Scans an identifier with start characters A..Z, a..z, _ and all characters 0..9 inside.
|
StringPartScan |
scanIdentifier(java.lang.String additionalStartChars,
java.lang.String additionalChars)
Scans an identifier with start characters A..Z, a..z, _ and all characters 0..9 inside,
and additional characters.
|
StringPartScan |
scanInteger()
Scans an integer expression with possible sign char '-' at first.
|
StringPartScan |
scanInteger(java.lang.String separatorChars) |
StringPartScan |
scanInteger(java.lang.String separatorChars,
java.lang.String[] scannedString)
Scans an integer expression with possible sign char '-' or '+' as first char and possible separator chararcter.
|
StringPartScan |
scanLiteral(java.lang.String startEndTrans,
int maxToTest)
Scans a literal given in quotation mark characters.
|
boolean |
scanOk()
Test the result of scanning and set the scan Pos Ok, if current scanning was ok.
|
StringPartScan |
scanPositivInteger()
Scanns a integer number as positiv value without sign.
|
StringPartScan |
scanQuotion(java.lang.CharSequence sQuotionmarkStart,
java.lang.String sQuotionMarkEnd,
java.lang.String[] sResult) |
StringPartScan |
scanQuotion(java.lang.CharSequence sQuotionmarkStart,
java.lang.String sQuotionMarkEnd,
java.lang.String[] sResult,
int maxToTest) |
StringPartScan |
scanSkipComment()
Skips over white spaces and comments.
|
StringPartScan |
scanSkipSpace()
Skips over white spaces.
|
StringPartScan |
scanStart()
Starts the scan at current position
|
StringPartScan |
scanStart(boolean bSkipWhitepaces)
Starts the scan at current position
|
StringPartScan |
scanToAnyChar(java.lang.CharSequence[] dst,
java.lang.String sCharsEnd,
char transcriptChar,
char quotationStartChar,
char quotationEndChar)
Scans a String with maybe transliterated characters till one of end characters,
maybe outside any quotation.
|
StringPartScan |
scanToAnyChar(java.lang.String sCharsEnd,
char transcriptChar,
char quotationStartChar,
char quotationEndChar)
Scans a String with maybe transcription characters till one of end characters,
maybe outside any quotation.
|
StringPartScan |
seekScanPos(int pos)
Sets the current begin to pos relativ to the current part.
|
absCharAt, absSubString, assign, assign, assignFromEnd, assignReplaceEnv, charAt, checkCharAt, clean, compareTo, contentTillSpaceEndOrQuotation, debugString, equals, firstlineMaxpart, found, fromEnd, getCharSequenceRange, getCurrent, getCurrent, getCurrentChar, getCurrentColumn, getCurrentPart, getCurrentPart, getCurrentPosition, getInputfile, getLastPart, getLenCurrent, getLineAndColumn, getPart, indexEndOfQuotation, indexEndOfQuotation, indexEndOfQuotion, indexOf, indexOf, indexOf, indexOf, indexOfAnyChar, indexOfAnyChar, indexOfAnyChar, indexOfAnyCharOutsideQuotation, indexOfAnyCharOutsideQuotion, indexOfAnyString, indexOfNoChar, indexOfNoChar, iterator, lastIndexOfAnyChar, len0end, lenBacktoNoChar, lenBacktoNoWhiteSpaces, length, lengthMaxPart, lento, lento, lento, lento, lentoAnyChar, lentoAnyChar, lentoAnyChar, lentoAnyCharOutsideQuotation, lentoAnyCharOutsideQuotion, lentoAnyNonEscapedChar, lentoAnyString, lentoAnyString, lentoAnyStringWithIndent, lentoIdentifier, lentoIdentifier, lentoLineEnd, lentoNonEscapedString, lentoNumber, lentoPos, lentoQuotionEnd, line, nextlineMaxpart, replace, seek, seek, seek, seek, seekAfterNewline, seekAnyChar, seekAnyString, seekBackToAnyChar, seekBackward, seekBegin, seekCheck, seekCheckEnd, seekEnd, seekNextLine, seekNoChar, seekNoWhitespace, seekNoWhitespaceOrComments, seekPos, seekPosBack, setBeginMaxPart, setCurrentMaxPart, setCurrentPartTo, setCurrentPosition, setIgnoreComment, setIgnoreComment, setIgnoreEndlineComment, setIgnoreEndlineComment, setIgnoreWhitespaces, setInputfile, setLengthMax, setParttoMax, skipWhitespaceAndComment, startsWith, subSequence, substring, toString, trim, trimComment, trimWhiteSpaces, XXXindexOf
public static final java.lang.String sVersion
IllegalStateException
which should not be caught on user level. This is especially only for software errors
such as programmed too many scanInteger()
in the user software without the appropriate
getLastScannedIntegerNumber()
. Not all possible yet. It prevents unnecessary effort on using.
scanAnyChar(String)
writes its result also to getLastScannedString()
.
scanAnyChar(String)
scanChar(char)
was missing for usage. Firstly in the C++ version.
Why it is missing? forgotten, really simple necessary. Only tested in the moment in C++, works.
Hint: scan(CharSequence)
is possible to use instead, but too complex in C/++ language
readNextContent(int)
.
It is the old routine StringPartFromFileLines.readnextContentFromFile(int)
here offered make it possible
to use a longer input but use this base class too. The default implementation in this class is empty
because this class presents the whole content in StringPart.content
.
scanEntry()
.
new: scan(CharSequence)
works with \W and \Z (no identifier char, end of text)
scanLiteral(String, int)
scanToAnyChar(String, char, char, char)
which stores the parse result in this class.
getLastScannedString()
with up to five storage places, should run in C too (TODO test).
scanDigits(int, int, String)
invokes adequate (and new) StringFunctions_C.parseUlong(CharSequence, int, int, int, int[], String)
scanInteger(String)
with possible separator chars (used in ZBNFParser with new feature)
scanFractionalNumber(long, boolean)
, scanFloatNumber(char, boolean, String)
with test, see org.vishia.util.test.Test_StringPartScan
.
sLastString
is now a final instance, not a reference, set in StringPart.setCurrentPartTo(Part)
.
scanQuotion(CharSequence, String, String[], int)
,
scanIdentifier(String, String)
seekScanPos(int)
invokes StringPart.seekPos(int)
but returns this as StringPartScan to concatenate.
It is the first typical routine for concatenation. TODO more. The problem is, the routines from StringPart
can be invoked, but not simple concatenate.
getLastScannedPart()
scanStart(boolean)
possible to switch on bSkipWhitepaces. More simple for invocation.
scan()
now invokes scanStart()
automatically, it is the common use case.
scanFractionalNumber(long, boolean)
has had a problem with negative numbers.
Therefore scanFractionalNumber(long, boolean)
with bNegative as argument. Used in CalculatorExpr
too.
new getLastScannedIntegerSign()
to check whether "-0" was scanned which may be "-0.123" as a negative number.
scanOk()
cannot used nested! It should only used on user level.
Elsewhere the scan start position is erratic changed. Don't use it in scanFloatNumber()
.
#scanFractionalNumber(long)
enables scanning first an integer, then check whether
it is a possibility to detect whether an intgeger or a float value is given.
scanSkipSpace()
and scanSkipComment()
calls StringPart.seekNoWhitespace()()
etc
but returns this to concatenate.
protected int beginScan
protected int beginScanLast
protected final long[] nLastIntegerNumber
protected final boolean[] nLastIntegerSign
private int ixLastIntegerNumber
protected final double[] nLastFloatNumber
private int ixLastFloatNumber
protected final StringPart.Part[] sLastString
getLastScannedString()
It is more C-friendly with a nested instance. No heap effort.private int ixLastString
public StringPartScan(java.lang.CharSequence src, int begin, int end)
public StringPartScan(java.lang.CharSequence src)
public StringPartScan()
public StringPartScan seekScanPos(int pos)
StringPart.seekPos(int)
and returns this.pos
- public final StringPartScan scanSkipSpace()
StringPart.seekNoWhitespace()
and return this.public final StringPartScan scanSkipComment()
StringPart.seekNoWhitespaceOrComments()
and return this.public final StringPartScan scanStart(boolean bSkipWhitepaces)
bSkipWhitepaces
- invokes StringPart.setIgnoreWhitespaces(boolean)
with this argument.
If true then whitespaces will be skipped by the next scan invocations.public final StringPartScan scanStart()
public final StringPartScan scan()
StringPart
is the same than scanStart().scan
in class StringPart
StringPart.scan()
private final boolean scanEntry()
scanOk()
or scanStart()
clears the buffer for numbers, so that 5 numbers can be stored in any scanning concatenation.public final boolean scanOk()
scanStart(); //call scanOk() independent of the last result. Set the scan start. if(scanIdentifier().scanOk()) { //do something with the indentifier } else if(scanFloat().scanOk()) { //a float is detected } else if ....It is not yet possible for nested options.
public final StringPartScan scanChar(char cmp)
cmp
- this charscanOk()
to test the result.public final StringPartScan scanAnyChar(java.lang.String cmp)
cmp
- all expected characters, one of them should matchscanOk()
to test the result.public final StringPartScan scan(java.lang.CharSequence sTestP)
StringFunctions.cNoCidentifier
it is tested that no identifier chars follows.
This is important for example to distinguish between "if..." and "ifVariable".
StringPart.seekNoWhitespaceOrComments()
.sTest
- String to testpublic final StringPartScan scanQuotion(java.lang.CharSequence sQuotionmarkStart, java.lang.String sQuotionMarkEnd, java.lang.String[] sResult)
sQuotionmarkStart
- sQuotionMarkEnd
- sResult
- public final StringPartScan scanQuotion(java.lang.CharSequence sQuotionmarkStart, java.lang.String sQuotionMarkEnd, java.lang.String[] sResult, int maxToTest)
sQuotionmarkStart
- sQuotionMarkEnd
- sResult
- maxToTest
- public StringPartScan scanLiteral(java.lang.String startEndTrans, int maxToTest)
scanQuotion(CharSequence, String, String[], int)
startEndTrans:
- for example "\"\"\\" or "<>'".
The first character is the start quotation character, second is end quotation mark.
If the third character is given (Length >2) then the character after that character is not recognized as end quotation.
Usual the third character is the transliteration character known from standard languages for \n, \" etc.maxToTest
- if >=0, the maximal number of characters inclusively the quotation marks for that part.
if < 0, no limitation, thest till end.public final StringPartScan scanDigits(int radix, int maxNrofChars, java.lang.String separatorChars, java.lang.String[] scannedString)
radix
- maxNrofChars
- Maybe -1, Integer.MAX_VALUE
or a lesser number as the actual part to limit the range.separatorChars
- Any character are accept inside the number as a separation character. For Example _ or ' or , to write:
12'345 12,234 12_345
which is parsed as 12345 in any case. Usual such as "'"scannedString
- if given, then [0] is filled with the parsed String to return the format, since 2022-04-28java.text.ParseException
public final StringPartScan scanDigits(int radix, int maxNrofChars, java.lang.String separatorChars) throws java.text.ParseException
java.text.ParseException
public final StringPartScan scanPositivInteger() throws java.text.ParseException
getLastScannedIntegerNumber()
.
There can stored upto 5 numbers. If more as 5 numbers are stored yet,
an exception is thrown.java.text.ParseException
- if the buffer is not free to hold an integer number.public final StringPartScan scanInteger() throws java.text.ParseException
getLastScannedIntegerNumber()
.
There can stored upto 5 numbers. If more as 5 numbers are stored yet,
an exception is thrown.java.text.ParseException
- if the buffer is not free to hold an integer number.public final StringPartScan scanInteger(java.lang.String separatorChars, java.lang.String[] scannedString) throws java.text.ParseException
getLastScannedIntegerNumber()
.
There can stored upto 5 numbers. If more as 5 numbers are stored yet,
an exception is thrown.
getLastScannedPart()
with scanning only this routine: if(sp.scanStart().scanInteger("\"',").scanOk()) { String scannedNumberString = sp.getLastScannedPart().toString(); long scannedNumberInt = sp.getLastScannedIntegerNumber(); ....
separatorChars
- Some character which are accepted inside the nuumber as simple separator character
without semantic. For example a number with thousand separation written with 1"000'000 are convert as 1000000
if separatorChars are given with "\"'". But 1'000'000 delivers the same result for this example.
Usual only one separatorChar may be given.scannedString
- if given, then [0] is filled with the parsed String to return the format, since 2022-04-28java.text.ParseException
public final StringPartScan scanInteger(java.lang.String separatorChars) throws java.text.ParseException
java.text.ParseException
public final StringPartScan scanFloatNumber(boolean cleanBuffer) throws java.text.ParseException
getLastScannedFloatNumber()
.
There can stored upto 5 numbers. If more as 5 numbers are stored yet,
an exception is thrown.cleanBuffer
- true then clean the float number buffer because the values are not used.java.text.ParseException
- if the buffer is not free to hold the float number.public final StringPartScan scanFloatNumber() throws java.text.ParseException
getLastScannedFloatNumber()
.
There can stored upto 5 numbers. If more as 5 numbers are stored yet,
an exception is thrown.
scanOk()
, the integer is accepted as float.
Use scanFloatNumber(char, boolean, String)
with strict=true to distinguish from an integer.java.text.ParseException
- if the buffer is not free to hold the float number.public final StringPartScan scanFloatNumber(char fractionalSeparator, boolean bStrict, java.lang.String separatorChars) throws java.text.ParseException
getLastScannedFloatNumber()
.
There can stored upto 5 numbers. If more as 5 numbers are stored yet,
an exception is thrown.fractionalSeparator
- usual '.', maybe ',' or other for language specificabStrict
- if true than expects a fractional separator or an exponent or both (to distinguish from integer)separatorChars
- See scanInteger(String)
java.text.ParseException
- if the buffer is not free to hold the float number.public final StringPartScan scanFractionalNumber(long nInteger, boolean bNegative) throws java.text.ParseException
nInteger
- The maybe parsed integer part before this fractional part.bNegative
- true if the integer part has a sign. It is essential if "-0" are scanned as integer.java.text.ParseException
#scanFractionalNumber(char, String, long, boolean)}
public final StringPartScan scanFractionalExponent(char fractionalSeparator, boolean bStrict, java.lang.String separatorChars, long nInteger, boolean bNegative) throws java.text.ParseException
getLastScannedFloatNumber()
.
if(spExpr.scanSkipSpace().scanInteger().scanOk()) { Value value = new Value(); long longvalue = spExpr.getLastScannedIntegerNumber(); if(spExpr.scanFractionalNumber(longvalue).scanOk()) { double dval = spExpr.getLastScannedFloatNumber(); if(spExpr.scan("F").scanOk()){ value.floatVal = (float)dval; value.type = 'F'; } else { value.doubleVal = dval; value.type = 'D'; } } else { //no float, check range of integer if(longvalue < 0x80000000L && longvalue >= -0x80000000L) { value.intVal = (int)longvalue; value.type = 'I'; } else { value.longVal = longvalue; value.type = 'L'; } }
fractionalSeparator
- usual '.', maybe ',' or other for language specificaseparatorChars
- See scanInteger(String)
nInteger
- The maybe parsed integer part before this fractional part.bNegative
- true if the integer part has a sign. It is essential if "-0" are scanned as integer.java.text.ParseException
- if the buffer is not free to hold the float number.public final StringPartScan scanHex(int maxNrofChars)
getLastScannedIntegerNumber()
.
There can stored upto 5 numbers. If more as 5 numbers are stored yet,
an exception is thrown.maxNrofChars
- parse no more, see scanDigits(int, int, String, String[])
java.text.ParseException
- if the buffer is not free to hold an integer number.public final StringPartScan scanHex(int maxNrofChars, java.lang.String[] scannedString) throws java.text.ParseException
getLastScannedIntegerNumber()
.
There can stored upto 5 numbers. If more as 5 numbers are stored yet,
an exception is thrown.maxNrofChars
- parse no more, see scanDigits(int, int, String, String[])
scannedString
- if given, then [0] is filled with the parsed String to return the format, since 2022-04-28java.text.ParseException
- if the buffer is not free to hold an integer number.public final StringPartScan scanHexOrDecimal(int maxNrofChars, java.lang.String[] scannedString) throws java.text.ParseException
getLastScannedIntegerNumber()
.
There can stored upto 5 numbers. If more as 5 numbers are stored yet,
an exception is thrown.maxNrofChars
- The maximal number of chars to scan, if <=0 than no limit.java.text.ParseException
- if the buffer is not free to hold an integer number.public final StringPartScan scanHexOrDecimal(int maxNrofChars) throws java.text.ParseException
java.text.ParseException
public final StringPartScan scanIdentifier()
getLastScannedString()
.public final StringPartScan scanIdentifier(java.lang.String additionalStartChars, java.lang.String additionalChars)
getLastScannedString()
.additionalStartChars
- additionalChars
- public final boolean getLastScannedIntegerSign() throws java.text.ParseException
getLastScannedIntegerNumber()
is invoked.java.text.ParseException
- if called though no scan routine was called.public final long getLastScannedIntegerNumber()
getLastScannedIntegerSign()
,
is removed.java.text.ParseException
- if called though no scan routine was called.public final double getLastScannedFloatNumber() throws java.text.ParseException
java.text.ParseException
- if called though no scan routine was called.public final java.lang.String getLastScannedString()
scanIdentifier()
public final StringPart.Part getLastScannedPart(int nr)
public final java.lang.CharSequence getLastScannedPart()
scanOk()
or scanStart()
and the following positive scanOk()
Note: The StringPart.getLastPart()
returns between StringPart.beginLast
and the begin position.
It is not the same but lightweigth equal for seek operations.scanOk()
has returned false. Elsewhere the proper StringPart.Part
;public final java.lang.CharSequence getCircumScriptionToAnyChar(java.lang.String sCharsEnd)
sCharsEnd
- Assembling of chars determine the end of the part.#scanToAnyChar(CharSequence[], String, char, char, char),
this method allows all transliteration and quotation characters.
public final java.lang.CharSequence getCircumScriptionToAnyCharOutsideQuotion(java.lang.String sCharsEnd)
sCharsEnd
- Assembling of chars determine the end of the part.getCircumScriptionToAnyChar(String)
,
#scanToAnyChar(CharSequence[], String, char, char, char),
private final java.lang.CharSequence getCircumScriptionToAnyChar_p(java.lang.String sCharsEnd, boolean bOutsideQuotion)
public final StringPartScan scanToAnyChar(java.lang.CharSequence[] dst, java.lang.String sCharsEnd, char transcriptChar, char quotationStartChar, char quotationEndChar)
scanToAnyChar(dst, ">?", '\\', '\"', '\"')does not end at a char > after an \ and does not end inside the quotation. If the following string is given:
a text -\>arrow, "quotation>" till > ...followingthen the last '>' is detected as the end character. The first one is a transcription, the second one is inside a quotation.
StringFunctions#convertTranscription(CharSequence, char)
:
Every char after the transcriptChar is accepted. But the known transcription chars
\n, \r, \t, \f, \b are converted to their control-char- equivalence.
The \s and \e mean begin and end of text, coded with ASCII-STX and ETX = 0x2 and 0x3.
The actual part is tested for this, after this operation the actual part begins
after the gotten chars!dst
- if it is null, then no result will be stored, elsewhere a CharSequence[1].sCharsEnd
- End characterstranscriptChar
- typically '\\', 0 if not usedquotationStartChar
- typically '\"', may be "<" or such, 0 if not usedquotationEndChar
- The end char, typically '\"', may be ">" or such, 0 if not usedStringPart#indexOfAnyChar(String, int, int, char, char, char)}, used here.
,
StringFunctions#convertTransliteration(CharSequence, char)}, used here.
public final StringPartScan scanToAnyChar(java.lang.String sCharsEnd, char transcriptChar, char quotationStartChar, char quotationEndChar)
scanToAnyChar(">?", '\\', '\"', '\"')does not end at a char > after an \ and does not end inside the quotation. If the following string is given:
a text -\>arrow, "quotation>" till > ...followingthen the last '>' is detected as the end character. The first one is a transcription, the second one is inside a quotation.
StringFunctions#convertTranscription(CharSequence, char)
:
Every char after the transcriptChar is accepted. But the known transcription chars
\n, \r, \t, \f, \b are converted to their control-char- equivalence.
The \s and \e mean begin and end of text, coded with ASCII-STX and ETX = 0x2 and 0x3.
The actual part is tested for this, after this operation the actual part begins
after the gotten chars!
sLastString
,
can be gotten with getLastScannedPart()
.sCharsEnd
- End characterstranscriptChar
- typically '\\', 0 if not usedquotationStartChar
- typically '\"', may be "<" or such, 0 if not usedquotationEndChar
- The end char, typically '\"', may be ">" or such, 0 if not usedStringPart#indexOfAnyChar(String, int, int, char, char, char)}, used here.
,
StringFunctions#convertTransliteration(CharSequence, char)}, used here.
public boolean readNextContent(int minPosToRead) throws java.io.IOException
StringPart.begin
is lesser than
the argument minPosToRead.StringPart.begin
is < 1/8 of the size.
That is especially after reading head information.StringPart.content
but only the half of current content.
Especially StringPart.Part
remain accessible if they are near the current content.
See remarks there about persistence.minPosToRead
- returns without action if Current position (it is StringPart.begin
) is lesser.
Set =0 for reading the first content.
Set to about 2/3 of size for normal operation.java.io.IOException
public void close()
Closeable
is not used here.close
in class StringPart