One Star

Extraction of image files using talend

Hi,
  I want to extract JPEG files using talend and then store it to HDFS and to hive external table. Is it possible.? What Datatype should i use? how to proceed?
Thanks in advance..
1 REPLY
Six Stars

Re: Extraction of image files using talend

I think maybe you can read the binary content of each file in Talend to String, so use tFileList to list file -> and then some tFileInputRaw. Then you store it by tHDFSOutput component.
The pure Java way here is quite straight forward:
try{
Path pt=new Path("hdfs:/jp./myserver.com:9000/user/someuser/out/somepath");
FileSystem fs = FileSystem.get(new Configuration());
BufferedWriter br=new BufferedWriter(new OutputStreamWriter(fs.create(pt,true)));
// TO append data to a file, use fs.append(Path f)
String line;
line="This is BINARY content fo JPEG in String form";
System.out.println(line);
br.write(line);
br.close();
}catch(Exception e){
System.out.println("File not found");
}