I have a file that has Java serialized objects such as "vector" I have given this file to handup the distributed file system (HDFS ). Now I want to read this file (use the Read Read object) in one of the map jobs. I think
FileInputStream = new FileInputStream ("hdfs / path / to / file");
The habit is stored on HDFS as 'work'. So I thought about using the org.apache.hadoop.fs.FileSystem class. But unfortunately there is no way back to FileInputStream. All this is a method that gives FSDataInputStream, but I want an inputstream that can read CRialized Java objects such as vector instead of just one primitive data types that FSDataInputStream does.
Please help!
The serialized objects do not give you directly to read, you need to wrap it in it with you You can do this, just wrap it up and then you can read your items from it.
In other words, if you have fileSystem
type org Apache.hadoop.fs.FileSystem
, just use:
ObjectInputStream = new ObjectInputStream (fileSystem.open (path));
Comments
Post a Comment