I have create a class VectorWritable which implements the interface Writable. I am trying to write a VectorWritable object to the output file but i am getting this: VectorWritable@1355b88b. Here is my write method:
public void write(DataOutput out) throws IOException {
getVectorString().write(out);
}
The function getVectorString() gives a Text object.
I don't have 50 rep to comment, so I will write it as an answer.
How do you create this Text object inside getVectorString()? Aren't you invoking default toString() method on the VectorWritable object, which returns strings like "VectorWritable@1355b88b" unless you override it to return a more useful string which describes your object?
EDIT:
According to your comment
Text vectorStringis a member ofVectorWritableclass, you set thisTextobject insetmethod so i guess that thesetmethod is also insideVectorWritable, and it is not a static method, so why do you pass aVectorWritableobject to it? It looks like you could invoke thissetmethod on oneVectorWritableobject, pass another to it, and havevectorStringnot matching surroundingVectorWritableobject.How do you write
VectorWritableto the output? Do you invoke thewritemethod which you posted inside your question? Because this outputVectorWritable@1355b88blooks like you passVectorWritableas an argument to a method which invokes its defaulttoString()method which would return string likeVectorWritable@1355b88b.Writable interface is used to serialize objects. So you can write the object to an output, and read it back, but with your implementation it would be hard to parse the string you create and read the object back. Example of implementation