this is thrift_file.thrift
struct my_file{
1: string file_url
2: string file_contents
}
and this is my ruby script
require 'thrift'
$:.push("gen-rb")
require 'thrift_file_constants'
my_file = My_file.new
my_file.file_url = "given_url_string"
my_file.file_contents=""
input_file=File.open("big_text.txt", "r")
input_file.each {|line|
my_file.file_contents << line
}
input_file.close()
serializer = Thrift::Serializer.new
binary_str=""
binary_str=serializer.serialize(my_file)
output_file=File.open("big_text.thrift_format", "w+")
output_file.puts(binary_str)
output_file.close()
------------------------------------
now, shouldnt mybig_text.thrift_format file be in binary format? Strangely
I am able to 'cat' it and its in human readable format too! What am I doing
wrong? Isnt the serialize method supposed to convert my string to binary
format?