Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
// template routine Java
package routines;
import java.io.*;
/*
* user specification: the function's comment should contain keys as follows: 1. write about the function's comment.but
* it must be before the "{talendTypes}" key.
*
* 2. {talendTypes} 's value must be talend Type, it is required . its value should be one of: String, char | Character,
* long | Long, int | Integer, boolean | Boolean, byte | Byte, Date, double | Double, float | Float, Object, short |
* Short
*
* 3. {Category} define a category for the Function. it is required. its value is user-defined .
*
* 4. {param} 's format is: {param} <type> <name>
*
* <type> 's value should be one of: string, int, list, double, object, boolean, long, char, date. <name>'s value is the
* Function's parameter name. the {param} is optional. so if you the Function without the parameters. the {param} don't
* added. you can have many parameters for the Function.
*
* 5. {example} gives a example for the Function. it is optional.
*/
public class fichierRef {
/**
* readFile: lit le fichier pdf et renvoi une chaine
*
*
* {talendTypes} String
*
* {Category} User Defined
*
* {param} string() input: le nom du fichier à lire
*
* {example} readFile("/etc/passwd") # hacking en cours ...
*/
public static String readFile(String fichier) {
String chaine = new String() ;
try {
InputStream ips=new FileInputStream(fichier);
InputStreamReader ipsr=new InputStreamReader(ips);
BufferedReader br=new BufferedReader(ipsr);
String ligne;
while ((ligne=br.readLine())!=null){
chaine+=ligne+"\n";
}
br.close();
return chaine ;
}catch(Exception e){
return "";
}
}
// template routine Java
package routines;
import java.io.*;
/*
* user specification: the function's comment should contain keys as follows: 1. write about the function's comment.but
* it must be before the "{talendTypes}" key.
*
* 2. {talendTypes} 's value must be talend Type, it is required . its value should be one of: String, char | Character,
* long | Long, int | Integer, boolean | Boolean, byte | Byte, Date, double | Double, float | Float, Object, short |
* Short
*
* 3. {Category} define a category for the Function. it is required. its value is user-defined .
*
* 4. {param} 's format is: {param} <type> <name>
*
* <type> 's value should be one of: string, int, list, double, object, boolean, long, char, date. <name>'s value is the
* Function's parameter name. the {param} is optional. so if you the Function without the parameters. the {param} don't
* added. you can have many parameters for the Function.
*
* 5. {example} gives a example for the Function. it is optional.
*/
public class fichierRef {
/**
* readFile: lit le fichier pdf et renvoi une chaine
*
*
* {talendTypes} String
*
* {Category} User Defined
*
* {param} string() input: le nom du fichier à lire
*
* {example} readFile("/etc/passwd") # hacking en cours ...
*/
public static String readFile(String fichier) {
String chaine = new String() ;
try {
InputStream ips=new FileInputStream(fichier);
InputStreamReader ipsr=new InputStreamReader(ips);
BufferedReader br=new BufferedReader(ipsr);
String ligne;
while ((ligne=br.readLine())!=null){
chaine+=ligne+"\n";
}
br.close();
return chaine ;
}catch(Exception e){
return "";
}
}
hi,
I also tried adding the tFileOutputPDF after adding this in the talend tool in options window--->preferences--->talend--->components--->user component folder but not able to view in the palette.
Please help me giving some suggestions
Thank's
jones