Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2006

Tip: Looking for answers? Try searching our database.

Bytes that just... disappear...

Thread view: 
AndrewTK - 09 May 2006 21:15 GMT
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...!


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.