Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. import java.io.File;
  2. import java.io.IOException;
  3.  
  4. public class DirProcessor
  5. {
  6. public DirProcessor(FileProcessor fileProcessor) {
  7. this.fileProcessor = fileProcessor;
  8. }
  9.  
  10. FileProcessor fileProcessor;
  11.  
  12. public int countSymbolsFromPackage(String folderPath) throws IOException
  13. {
  14. File folder = new File(folderPath);
  15. File[] listOfFiles = folder.listFiles();
  16. int sum = 0;
  17. for (File file : listOfFiles) {
  18. String filePath = file.getPath();
  19. if (filePath.contains(".txt")) {
  20. sum += fileProcessor.countSymbols(filePath);
  21. }
  22. }
  23. return sum;
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement