• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to read a binary file into an array of protobuf's ?  RSS feed

 
yair fridman
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have a binary file that i want to read into array of my Google's Protocol Buffers structure .
how can it be implemented ?
i tried the `parsedFrom(inputStream) ` method but it only read the last item in the file.
please add code example if you can, i searched the net but didn't see any code example of this one.
 
Winston Gutkowski
Bartender
Posts: 10573
65
Eclipse IDE Hibernate Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yair fridman wrote:i have a binary file that i want to read into array of my Google's Protocol Buffers structure .
how can it be implemented ?
i tried the `parsedFrom(inputStream) ` method but it only read the last item in the file.
please add code example if you can, i searched the net but didn't see any code example of this one.

I'm not familiar with Google's Protocol Buffers structure, but it seems to me that that's where you should probably start - if indeed the structure allows you to do this. If not, then it sounds to me like you want to "hack" the structure, and that may be very involved and error-prone.

Alternatively, if this "binary file" is just a serialized form of the structure, use a DataInputStream.

HIH

Winston
 
yair fridman
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
working , thanks !
 
Winston Gutkowski
Bartender
Posts: 10573
65
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yair fridman wrote:working , thanks !

Don't know what I did, but you're welcome.

Winston
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!