Interface IInputBuffer
- All Known Implementing Classes:
LineJavaCoreInputBuffer
,OffsetBasedJavaCoreInputBuffer
public interface IInputBuffer
-
Method Summary
Modifier and TypeMethodDescriptionchar
charAt
(int i) Retrieves a character at a given position.void
close()
Closes the java.io.Reader or input stream associated with this buffered reader.int
consume
(int length) Consumes a sublength of the buffer, if the sublength is > 0 and sublength invalid input: '<'= buffer length.boolean
int
length()
NOTE That the length of the buffer may vary during character consumption, so it cannot be assumed to be fixed all the time.boolean
nextLine()
Reads the next line if the current buffer is empty.
-
Method Details
-
consume
Consumes a sublength of the buffer, if the sublength is > 0 and sublength invalid input: '<'= buffer length. It then reads from the input source to refill the previously freed spaces.- Parameters:
amount
- of characters to consume.- Returns:
- return the offset value of the consumed portion. Note that this does not return the new offset after consumption but the offset of the section being consumed.
- Throws:
IOException
- if error occurs while refilling the buffer.
-
close
Closes the java.io.Reader or input stream associated with this buffered reader.- Throws:
IOException
- if error encountered while closing.
-
charAt
char charAt(int i) Retrieves a character at a given position. No consumption occurs. Typically used by an external scanner to determine if a sequence of characters in the buffer matches a desired pattern. If so, the pattern is consumed by a consume method.- Parameters:
buffer
- index where character is located- Returns:
- character at specified index
-
endReached
boolean endReached()- Returns:
- boolean: determines if everything has been consumed from the reader stream.
-
nextLine
Reads the next line if the current buffer is empty. Returns true if a new line read, false otherwise.- Throws:
IOException
-
length
int length()NOTE That the length of the buffer may vary during character consumption, so it cannot be assumed to be fixed all the time.- Returns:
- the length of the buffer
-