Package eu.bandm.tools.rdparser
Class IncludingCharBuf.CharBuf
java.lang.Object
eu.bandm.tools.rdparser.IncludingCharBuf.CharBuf
- Enclosing class:
IncludingCharBuf<D>
Auxiliary class for
IncludingCharBuf, representing exactly
one source of character data, ie the original file or inserted expansions.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intHow many characters to read when filling from file.protected char[]The complete data, read in when constructing the object.protected IncludingCharBuf<D>.@Opt CharBufChaining to callingCharBufobject.protected intThe length of the complete data, in characters.Position of the lastbufferConsume().protected intCurrent read position.Position of the firstIncludingCharBuf.consume(). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidAdvance position counter and line number, if linefeed is detected.charbufferLA(int k) Look ahead to the next k-th character, either in its own data, or in the caller.protected voidFill the data from all contents of the reader, until its "eof".(package private) booleanisNewline(char c) Decide if the next character is a newline.
-
Field Details
-
location
Position of the lastbufferConsume(). (May be one position beyond the exisiting data, but this will be detected by the callerbufferConsume()immediately.) -
startLocation
Position of the firstIncludingCharBuf.consume(). -
data
protected char[] dataThe complete data, read in when constructing the object. -
len
protected int lenThe length of the complete data, in characters. -
CHUNKSIZE
protected static final int CHUNKSIZEHow many characters to read when filling from file.- See Also:
-
pos
protected int posCurrent read position. -
host
Chaining to callingCharBufobject.
-
-
Constructor Details
-
CharBuf
public CharBuf(Reader r, @Opt IncludingCharBuf<D>.@Opt CharBuf buf, @Opt @Opt Location<D> loc) throws IOException Create a new buffer, link it viahostto the calling text, and fill it with all character data from r.- Parameters:
r- sourcebuf- calling predecessorloc- location of the start of the data- Throws:
IOException
-
CharBuf
Create a new buffer, link it viahostto the calling text, and take the array s as its character data.- Parameters:
s- a character store, directly used by the new buffer.buf- calling predecessorloc- location of the start of the data
-
-
Method Details
-
fill
Fill the data from all contents of the reader, until its "eof".- Throws:
IOException
-
bufferLA
public char bufferLA(int k) Look ahead to the next k-th character, either in its own data, or in the caller. The next-to-consume character is looked at with k=0(zero). -
bufferConsume
void bufferConsume()Advance position counter and line number, if linefeed is detected. The switch-back to the including buffer, if this has reached its end, is made by the callerIncludingCharBuf.consume().Assume that all input is normalized to "\n" = "^J" = linefeed. (windows cr and apple cr-lf have been replaced.) After the line number is incremented, the field
locationhas the same column number as theIncludingCharBuf.initialFirstColumnNumber, the veys first location on constructing the containing instance. -
isNewline
boolean isNewline(char c) Decide if the next character is a newline. Assume that the input is normalized to "\n" = "^J" = linefeed. (windows cr and apple cr-lf have been replaced.)
-