FileInputStream for a generic file System
Posted
by Akhil
on Stack Overflow
See other posts from Stack Overflow
or by Akhil
Published on 2010-05-15T11:17:57Z
Indexed on
2010/05/15
11:24 UTC
Read the original article
Hit count: 296
filesystems
|hdfs
I have a file that contains java serialized objects like "Vector". I have stored this file over Hadoop Distributed File System(HDFS). Now I intend to read this file (using method readObject) in one of the map task. I suppose
FileInputStream in = new FileInputStream("hdfs/path/to/file");
wont' work as the file is stored over HDFS. So I thought of using org.apache.hadoop.fs.FileSystem class. But Unfortunately it does not have any method that returns FileInputStream. All it has is a method that returns FSDataInputStream but I want a inputstream that can read serialized java objects like vector from a file rather than just primitive data types that FSDataInputStream would do.
Please help!
© Stack Overflow or respective owner