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

write/read two byte arrays to single file- please help!  RSS feed

 
Lana Al
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm doing a java program, and i have to store two byte arrays to single file and read them back in another class, how can i do that? i know how to do it with one array using FileInputStream, i tried to serialize the data and i thought it works but its not the code as below:





the out put is: the data: Hana the primitive: 3 the key: Hana



but the output should be like this: the data: Hana the primitive: 3 the key: abc
it should read the key=abc!
whats the wrong i did? , i'm new to serialization, and i dont know and i couldnt find out!!! please help
is there a better way or what is the wrong here?

 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a close look at line 11 of your code.
 
Lana Al
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
omg!!! thank you very much
funny!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!