This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Convert a BufferedReader varaible into an int?

 
Rik Ny
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to know how to convert a BufferedReader varaible into an int for my switch statement?? Here's what i have so far...
public void sendto(BufferedReader response)
{
try
{
int option = response.read();
switch(option)
 
Manoj Chandran
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rik,
Your question is not clear.As far as what u asked it is not possible to convert a BufferedReader variable into int bcoz first one is an object and second one is a primitive type and ia not compatible.
But if u want to perform swtich depending on the characters read from the stream the you can safely use the read() method which returns an int representation of the next available character in the stream...
manoj chandran,
Software Engg,SSi
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic