Java concat files

Snippet to concat several files into a new one with Java:

import org.apache.commons.io.IOUtils;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;


OutputStream destinationStream = null;
InputStream is = null;

File fileDir = new File("path_to_directory");
File destination = new File("path_to_destination");

try {
   destinationStream = new BufferedOutputStream(new FileOutputStream(destination));
   for (File file: fileDir.listFiles()){
         is = new BufferedInputStream(new FileInputStream(file));
         IOUtils.copy(is, destinationStream);
         destinationStream.write("\n".getBytes()); //Separate files
      } finally {
} finally {

Enjoy it!


New Year, New Challenges :-)

Perhaps it’s a human tradition, but once started the new Year people has a lot of good propositions to do during the year. In this regard, I (a common software engineer, but a person too 😉 ) have my own propositions, as the rest of the world. And one of them is to resurrect this blog, an exciting but hard task.

In my opinion it will be it will be hard, too hard, as not everybody will accept my opinions, thoughts, acts and experiences as good. Furthermore,  sometimes the energy to keep working hard will not be there.

On the other side, it will be very exciting, and challenging too!! I believe that as one arrives to his thirties, he has accumulated the enough knowledge and experiences to write them somewhere whether to share them to the rest of the world or simply to have somewhere where he can search them when his memory fails :-P.

By now, That’s all, hope to meet you again soon!