Hi,
I am trying to write an input stream that also caters for the concept
of "line"
My class uses a BufferedInputStream for the actual reading, and I add,
by extending, a readLine() method
I run into a problem when trying to read bytes: (I have code at
http://www.dcs.st-and.ac.uk/~atk1/java/BufferedStreamReader.java)
1/ I read bytes into a buffer byte array 'minibuff'
2/ I iterate over each byte and check for a CR, LF, or CRLF pair
Before I enter the iteration loop, it is possible to print out the
input received. Thereafter, the bytes don't appear to EXIST... The
printBinaryByte() method I provide works before the for loop is
entered, but disappears afterwards.
I don't really know how to explain what I mean by disappears... nothing
prints when your try to print the byte, and binary comparison yeilds
nothing at all either... nothing prints to nowhere.
I am very confused.
Eric Sosman - 09 May 2006 22:29 GMT
AndrewTK wrote On 05/09/06 16:15,:
> Hi,
>
[quoted text clipped - 14 lines]
> printBinaryByte() method I provide works before the for loop is
> entered, but disappears afterwards.
The loop never executes.
int line_end = -1;
// irrelevant stuff ...
for(int i=0;i<r && line_end != -1;i++) {
^^^^^^^^^^^^^^
equals false

Signature
Eric.Sosman@sun.com
AndrewTK - 10 May 2006 02:17 GMT
I have had the disappearing byte problem before, I swear... In a
different context though, so that's why I posted.
Albeit I look very stupid now. But thanks for the tip off...!