[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Java I/O on Stream
U can write the readline() function but why reinvent the wheel. The
bufferedreader does this for you. Also bufferedreader is a subclass of
reader so u can read a byte, array of bytes and a line.
I have not been able to grasp this thread completely, so if this does
not help then detail your scenario a bit more clearly.
-Vikrant
-----Original Message-----
From: cfowler [mailto:cfowler@outpostsentinel.com]
Sent: Thursday, November 07, 2002 2:56 PM
To: Brian Lee
Cc: ajug-members@ajug.org
Subject: Re: Java I/O on Stream
I'm working on a socket where I have to start in line mode to validate
commands then drop toy char by char mode for user interaction. I was
not buffering until we ran this class on a 800 mhz machine. Things
started falling apart because I was not able to read data fast enough
from the socket and read() was not returning a line. Then I relized
that I needed to do a readLine() instead and then drop to non-buffered
mode.
On Thu, 2002-11-07 at 14:40, Brian Lee wrote:
> If it's character data you can use
> java.io.BufferedReader(java.io.InputStreamReader(InputStream)).
>
> It will also buffer your stream for performance purposes.
>
> I'm not a big fan of java io, but I keep telling myself that the new
jdk1.4
> nio is going to be better (but can't bring myself to look at it).
>
> BAL
>
> >From: cfowler <cfowler@outpostsentinel.com>
> >To: ajug-members@ajug.org
> >Subject: Java I/O on Stream
> >Date: 07 Nov 2002 14:30:23 -0500
> >
> >
> >
> >Java I/O still confuses me!. I need to take an InputStream that is
> >connected to a socket and convert it to a Object that will allow me
to
> >do a readLine(). I gues I can allways extend InputStream and add a
> >readLine() function.
> >
> >Any help would be appreciated.
> >
> >Chris
>
>
> _________________________________________________________________
> The new MSN 8: smart spam protection and 2 months FREE*
> http://join.msn.com/?page=features/junkmail
>
>
>