• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

Socket questions looking for answer

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
IF we create a sockets and socket connected to the internet or somehting and downloaded some files, Which stream object we should use if we want to read line by line?
A)s.getInputStream();
b)ByteArrayStream ()
c)ByteArrayReader(s.getInputStream());
d)None of the above;
Please help to give the answer.
Thank you!
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I think the answer is d( None of the above). If we want to read line by line from a socket, we should use
BufferedReader( new InputStreamReader( s.getInputStream() ));
Please correct me if I'm wrong.

Erin
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Erin,
I think we could also use
LineNumberReader(new InputStreamReader(s.getInputStream() ));
Please let me know if I am wrong!
Thanks
-sampaths77
 
Adora
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you. I have no idea at all. Now, at least can exclude answer a,b,c.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sampaths,
I think both BufferedReader and LineNumberReader may work, since LineNumberReader is derived from BufferedReader.

Thanks,
Erin
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic