Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2007

Tip: Looking for answers? Try searching our database.

Binary data

Thread view: 
panklata@gmail.com - 28 Nov 2007 15:36 GMT
Hello :)
I need a little help. Im trying to get binary data from InputStream in
my servlet. But there is a little problemm. When i send values like

0x01 ... 0x9F  - everything semes to be ok but sending
0xA0 ... 0xFF - gives me values like 31-63

Here is me servlet code

---------------------------------------
int t = request.getInputStream().read();    <-- i think here is
something wrong but why ?
res.getOutputStream().write("Got : "+t);
---------------------------------------

Ill be happy if someone can help me :)
Thanks.
panklata@gmail.com - 28 Nov 2007 15:42 GMT
Ok got it ;] I was sending data in my test client, using
OutputStringWriter instead of simple OutputStream.

:)
Roedy Green - 29 Nov 2007 01:34 GMT
>int t = request.getInputStream().read();

you probably want a DataInputStream or a LEDataInputStream if you want
binary.   read just gets you bytes without any clumping into
primitives.

see http://mindprod.com/applet/fileio.html
for sample code.
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.