thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexis Gryta <alexis.gr...@crisalid.com>
Subject Deserialization failure with ruby : in `read_into_buffer': Not enough bytes remain in memory buffer (EOFError)
Date Mon, 16 Jun 2014 09:16:17 GMT
Hi,
I serialize my thrift object, I write a file with serialization.

    serializer = Thrift::Serializer.new()
    binary_string=serializer.serialize(ticket)
    bin = File.open("ticket.bin", "w+")
    bin.write(binary_string)
    bin.close

I open my file and I read and I try to serialize :

    binaryticket = File.open("ticket.bin", "r:UTF-8")
    contents = File.read(binaryticket)
    ticket_deserialise = Ticket.new
    deserializer = Thrift::Deserializer.new()
    ticket_deserialise = deserializer.deserialize(ticket_deserialise,
contents)

But I have a error :
binary_protocol.rb:185:in `read_into_buffer': Not enough bytes remain in
memory buffer (EOFError)

I don't understand...
If I try to deserialize with the "binary_string",(without file) =>  no
problem !

    ticket_deserialise = deserializer.deserialize(ticket_deserialise,
binary_string)

Ruby doesn't arrive to read file and to deserialize..

Thank you.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message