Initial commit

This commit is contained in:
2020-10-06 18:45:22 +02:00
commit fcbb4da4ba
4 changed files with 108 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
import java.io.File;
import org.apache.tika.Tika ;
public class EjemploSimple {
public static void main(String[] args) throws Exception {
// Creamos una instancia de Tika con la configuracion por defecto
Tika tika = new Tika();
// Se parsean los ficheros pasados como argumento y se extrae el contenido
for (String file : args) {
File f = new File(file);
// Detectamos el MIME tipo del fichero
String type = tika.detect(f);
System.out.println(file +":"+type);
// Extraemos el texto plano en un string
String text = tika.parseToString(f);
System.out.print(text);
}
}
}