Допустим, у меня есть файл t.txt, каталог t и другой файл t/t2.txt. Если я использую утилиту linux zip "zip -r t.zip t.txt t", я получаю zip файл со следующими записями в них (unzip -l t.zip):
Archive: t.zip
Length Date Time Name
-------- ---- ---- ----
9 04-11-09 09:11 t.txt
0 04-11-09 09:12 t/
15 04-11-09 09:12 t/t2.txt
-------- -------
24 3 files
Если я попытаюсь воспроизвести это поведение с помощью java.util.zip.ZipOutputStream и создать запись zip для каталога, java выдает исключение. Он может обрабатывать только файлы. Я могу создать запись t/t2.txt в zip файле и добавить к нему содержимое файла t2.txt, но я не могу создать каталог. Почему это?