(Message message)
| 643 | } |
| 644 | |
| 645 | protected static void unpackBundle(Message message) throws IOException { |
| 646 | logger.l4("Unpacking " + message.getMessageName()); |
| 647 | ZipInputStream zis = new ZipInputStream(message.getInputStream()); |
| 648 | ZipEntry ze; |
| 649 | while ((ze = zis.getNextEntry()) != null) { |
| 650 | String name = ze.getName().toLowerCase(); |
| 651 | logger.l5("found " + name); |
| 652 | int idx = name.lastIndexOf('/'); |
| 653 | if (idx >= 0) { |
| 654 | name = name.substring(idx + 1); |
| 655 | } |
| 656 | idx = name.lastIndexOf('\\'); |
| 657 | if (idx >= 0) { |
| 658 | name = name.substring(idx + 1); |
| 659 | } |
| 660 | if (name.matches("^[a-f0-9]{8}\\.pkt$")) { |
| 661 | File out = createInboundFile(message.isSecure()); |
| 662 | FileOutputStream fos = new FileOutputStream(out); |
| 663 | int len = 0; |
| 664 | do { |
| 665 | byte[] buf = new byte[1024]; |
| 666 | len = zis.read(buf); |
| 667 | if (len > 0) { |
| 668 | fos.write(buf, 0, len); |
| 669 | } |
| 670 | } while (len > 0); |
| 671 | fos.close(); |
| 672 | logger.l4(name + " was written as " + out.getName()); |
| 673 | } else { |
| 674 | logger.l3(name + " was deleted as unknown"); |
| 675 | } |
| 676 | } |
| 677 | zis.close(); |
| 678 | } |
| 679 | |
| 680 | public static File guessFilename(String filename, boolean read) { |
| 681 | filename = filename.replaceAll("^[\\./\\\\]+", "_"); |
no test coverage detected