(FtnPkt header, Link link, List<FtnMessage> messages)
| 1094 | } |
| 1095 | |
| 1096 | private static File createZipFile(FtnPkt header, Link link, |
| 1097 | List<FtnMessage> messages) throws IOException { |
| 1098 | File np = createOutboundFile(link); |
| 1099 | FileOutputStream out = new FileOutputStream(np); |
| 1100 | ZipOutputStream zos = new ZipOutputStream(out); |
| 1101 | zos.setMethod(ZipOutputStream.DEFLATED); |
| 1102 | ZipEntry ze = new ZipEntry(String.format("%s.pkt", generate8d())); |
| 1103 | ze.setMethod(ZipEntry.DEFLATED); |
| 1104 | CRC32 crc32 = new CRC32(); |
| 1105 | zos.putNextEntry(ze); |
| 1106 | int len = 0; |
| 1107 | byte[] data = header.pack(); |
| 1108 | len += data.length; |
| 1109 | crc32.update(data); |
| 1110 | zos.write(data); |
| 1111 | for (FtnMessage m : messages) { |
| 1112 | data = m.pack(); |
| 1113 | len += data.length; |
| 1114 | crc32.update(data); |
| 1115 | zos.write(data); |
| 1116 | } |
| 1117 | data = header.finalz(); |
| 1118 | len += data.length; |
| 1119 | crc32.update(data); |
| 1120 | zos.write(data); |
| 1121 | ze.setSize(len); |
| 1122 | ze.setCrc(crc32.getValue()); |
| 1123 | zos.close(); |
| 1124 | out.close(); |
| 1125 | return np; |
| 1126 | } |
| 1127 | |
| 1128 | /** |
| 1129 | * Эхобандл |
no test coverage detected