[2432] in java-interest

home help back first fref pref prev next nref lref last post

Re: Converting an int to a char?

daemon@ATHENA.MIT.EDU (Pat Niemeyer)
Mon Oct 2 04:37:05 1995

Date: Mon, 2 Oct 1995 01:16:36 -0500 (CDT)
From: Pat Niemeyer <pat@icon-stl.net>
To: John M Begenisich <begenisi@oswego.Oswego.EDU>
cc: java-interest@java.sun.com
In-Reply-To: <Pine.3.89.9510011633.A20843-0100000@sleepy>



On Sun, 1 Oct 1995, John M Begenisich wrote:

> I'm trying to convert an int to a character.  This is what I basically 
> have:
> 
>   String line = new String();
>   int dum=0;
>   while ((dum=(int)data.read())!=-1) {
>     b=(char)dum;
>     line+=(char)b;
>     ...blah blah blah...
>   }
>   System.out.print(line);

I'm not sure exactly what you're trying to do, but you probably want to
look at java.io.DataInputStream, which has methods to read numeric types
from a stream in a portable way.


Pat
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post