java 源码 GZIPOutputStream
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)
0 // Operating system (OS)
});
}
实例
// (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)
// 0 // Operating system (OS)
// 1f8b 08 00 00000000 00 00
+---+---+---+---+---+---+---+---+---+---+
|ID1|ID2|CM |FLG| MTIME |XFL|OS | (more-->)
+---+---+---+---+---+---+---+---+---+---+