• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1144
  • Last Modified:

converting charcode to String

HI All,

I use lBufferedReader.read() to read single characters from a Stream. But what frustrates me is that it does not return a String but rather an integer.
How do I convert this int to a String?
0
DaFou
Asked:
DaFou
  • 3
  • 2
2 Solutions
 
radarshCommented:
int i = 10;

String.valueOf(i) will return String "10"

________
radarsh
0
 
DaFouAuthor Commented:
but I need to convert a CharCode to the actual character it represents
0
 
StillUnAwareCommented:
String s = "";
while(condition)
    s += (char)br.read();

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
DaFouAuthor Commented:
I am trying to read all of an HTTP request. the request are characters but the read() returns a single int per call.
the int returned I suppose is the CharCode.

HOw do I convert the CharCode to the actual character?
0
 
StillUnAwareCommented:
Just do it the simple way. Read an int, convert it to char (the conversion here is correct) and add the char to the existing string:

s += (char)br.read();
0
 
StillUnAwareCommented:
glad to help
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now