- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
package java.util.zip;
public class GZIPOutputStream extends DeflaterOutputStream {
...
public GZIPOutputStream(OutputStream out, int size, boolean syncFlush)
throws IOException
{
super(out, out != null ? new Deflater(Deflater.DEFAULT_COMPRESSION, true) : null,
size,
syncFlush);
usesDefaultDeflater = true;
writeHeader();
crc.reset();
}
...
private void writeHeader() throws IOException {
out.write(new byte[] {
(byte) GZIP_MAGIC, // Magic number (short)
(byte)(GZIP_MAGIC >> 8), // Magic number (short)
Deflater.DEFLATED, // Compression method (CM)
0, // Flags (FLG)
0, // Modification time MTIME (int)
0, // Modification time MTIME (int)
0, // Modification time MTIME (int)
0, // Modification time MTIME (int)
0, // Extra flags (XFLG)
OS_UNKNOWN // Operating system (OS)
});
}
...
}
Выбрать уровень компрессии вам не дадут. написать имя файла вам не дадут. Написать комментарий вам не дадут. Жить будет в пакете для другого формата компрессии.