Posts a whole directory @return number of files posted total
(Path dir, OutputStream out, String type)
| 503 | * @return number of files posted total |
| 504 | */ |
| 505 | private int postDirectory(Path dir, OutputStream out, String type) throws IOException { |
| 506 | if (Files.isHidden(dir) && !dir.getFileName().toString().equals(".")) { |
| 507 | return 0; |
| 508 | } |
| 509 | info( |
| 510 | "Indexing directory " |
| 511 | + dir |
| 512 | + " (" |
| 513 | + listFiles(dir, fileFilter).size() |
| 514 | + " files, depth=" |
| 515 | + currentDepth |
| 516 | + ")"); |
| 517 | int posted = 0; |
| 518 | posted += postFiles(listFiles(dir, fileFilter), out, type); |
| 519 | if (recursive > currentDepth) { |
| 520 | for (Path d : listFiles(dir, Files::isDirectory)) { |
| 521 | currentDepth++; |
| 522 | posted += postDirectory(d, out, type); |
| 523 | currentDepth--; |
| 524 | } |
| 525 | } |
| 526 | return posted; |
| 527 | } |
| 528 | |
| 529 | /** |
| 530 | * Posts a collection of files identified by their paths |
no test coverage detected