Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

data type

 
McWon
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I connect to a remote server using socket and read through the stream, I want to know the data type I am currently reading so that I can deal with them correspondingly. How can know the type of data I am reading? Could anyone please help?
 
Carl Trusiak
Sheriff
Posts: 3340
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read and follow the Naming Policy. It can benefit you, read Book Promotions.
Unless you have first hand knowledge of the data types the server is sending and in what order, you can't. After all the word Help on the stream when read in as a byte array and converted to a string gives you 'Help' when read in as a 4 byte int gives you 1214606448.
Hope this helps

[This message has been edited by Carl Trusiak (edited January 18, 2001).]
 
McWon
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Carl,
I am using readLine() method in BufferedReader class, is a whole .gif file read in a whole line?
I only want to deal with text/html files. How can I discriminate them from other file types, like .jpeg, .class and so? Can I make a decision after read a few characters?
How could I change my user name? reregister?
 
Carl Trusiak
Sheriff
Posts: 3340
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, reregister The software will allow you to change everything but your user name.
Your using the wrong Input method. BufferedReader reads in things as Unicode and this will corrupt the data in your file. You need to use BufferedInputStream.

Hope this helps
[This message has been edited by Carl Trusiak (edited January 18, 2001).]
[This message has been edited by Carl Trusiak (edited January 18, 2001).]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic