File temp = new File(myPath.getAbsolutePath() + File.separator + "shares.ser");
if(temp.exists()){
temp.delete();
}
//sharing all files in shared directory
ContentManager contentManager = null;
contentManager = cms.getContentManager();
File[] list = myPath.listFiles();
Arrays.sort(
list,
new Comparator<File>() {
@Override
public int compare(File a, File b) {
return a.getName().compareTo(b.getName());
}
});
CheckSumCalc checkSum = new CheckSumCalc();
for (int i = 0; i < list.length; i++) {
if (list[i].isFile()) {//Sharing Files and check sums in network
contentManager.share(list[i], checkSum.getFileSum(list[i]));
}
}
printOnLog("======= Conteúdo compartilhado =======\n");
//viewing the shared contents
Content[] content = cms.getContentManager().getContent();