// read the first batch to fill the buffer
for (int i = 0; i < terminatorCharBuffer.length(); i++)
tempCharBuffer.put(readCharacter(stream, streamEncoding));
// compare and read next until arrays hold equal values
while (!(StringUtils.sequenceEqual(terminatorCharBuffer.array(), tempCharBuffer.array())))
{
// read next char
val ch = readCharacter(stream, streamEncoding);
// left shift elements in array, throw away the first read