• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

DataInputStream/ByteArrayInputStream/Binary Data and Encoding/Decoding

 
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I am facing a strange sort of issue.

I have some binary data (consisting of a set of floating point numbers), which i am encoding using Base64.encode to convert to a Character.

I put the data in some temporary storage(DB), and getting it back for processing.

When i get the string back, i decode it back using Base64.decode, and get a byteArray.

In order to read the float data, i am using




The data that i am getting using the above code, and the data which i get using directly reading from the file, is totally different.


The data in myfloat and myfloat2 list is entirely different.

Am i doing something really stupid here ?

P.S. I haven't touched Java for last 6 years, so kind of rusty at the moment! I will get there slowly but surely
Regards,

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know it's very late.
But, did you find the solution for this?
 
Marshal
Posts: 79178
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

Don't know but now you have posted, this thread will come to people's attention and you might get a response.
 
Saloon Keeper
Posts: 15510
363
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the original post, the only way the data can be different in these two cases is simply that the data in the array doesn't match the data in the file.

Arun, you should post the relevant part of the code you are working on so we can see what's wrong. Please provide your own problem description as well.

Note that nowadays Java has the Base64 class which has encoders and decoders that you can wrap around a stream.
 
reply
    Bookmark Topic Watch Topic
  • New Topic