My purpose is to serialize object to be a node of a btree.
ObjectInputStream in = new ObjectInputStream(fs.open(new
Path("hdfs://leon1:9000/myDir/trajectory/" + pathToken + ".obj")));
try {
tempbtree = (Btree) in.readObject();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
Maybe the path is correct , but it throws an error as following :
cannot assign instance of [J to field rtree.Bnode.loc of type
[Lrtree.Trajectory; in instance of rtree.Bnode
How can I solve this problem ? Thank so much for your suggestion.
2009/9/11 Jingkei Ly <[email protected]>
> Forgive me if I've got the wrong end of the stick as I'm not very clear on
> what you are trying to achieve. Based on your original post, I presume you
> have a serialized object that you have already stored in HDFS that you would
> like to read and deserialize?
> If that is the case, then you should use:
>
> ObjectInputStream in = new ObjectInputStream(FileSystem.open(new
> Path("hdfs://localhost:9000/myDir/trajectory/test.obj")));
>
>
> 2009/9/11 Bill Yu <[email protected]>
>
> Thanks for Jingkei's suggestion . But how can I serialize the input scream
>> to create a tree by FileSystem.open() ?
>> Anyone 's suggestion is appreciative!
>>
>> 2009/9/10 Jingkei Ly <[email protected]>
>>
>> You should use FileSystem.open() to obtain an input stream to read from
>>> HDFS (
>>> http://hadoop.apache.org/common/docs/current/api/org/apache/hadoop/fs/FileSystem.html#open%28org.apache.hadoop.fs.Path%29
>>> ).
>>>
>>> 2009/9/9 Bill Yu <[email protected]>
>>>
>>> Hi everyone,
>>>>
>>>> when I run the following code:
>>>>
>>>> ObjectInputStream in = new ObjectInputStream(new
>>>> FileInputStream("hdfs://localhost:9000/myDir/trajectory/test.obj"));
>>>>
>>>> it throws an error that the directory is not exist, how can I
>>>> define the its path ?
>>>> Any suggestion is appreciate !
>>>>
>>>> Thanks,
>>>> Austin
>>>
>>>
>>>
>>
>