title: Why is the GZIP "os" header hard-coded to FAT in Java?
body: <p><a href="https://www.rfc-editor.org/rfc/rfc1952" rel="nofollow noreferrer">RFC 1952</a> section 2.3.1 specifies that GZIP headers must contain an <code>OS</code> flag:</p>
  <blockquote>
  <p><strong><code>OS</code> (Operating System)</strong>. This identifies the type of file system on which compression took place.  This may be useful in determining end-of-line convention for text files. The currently defined values are as follows:</p>
  </blockquote>
  <pre><code>  0 - FAT filesystem (MS-DOS, OS/2, NT/Win32)
    1 - Amiga
    2 - VMS (or OpenVMS)
    3 - Unix
    4 - VM/CMS
    5 - Atari TOS
    6 - HPFS filesystem (OS/2, NT)
    7 - Macintosh
    8 - Z-System
    9 - CP/M
   10 - TOPS-20
   11 - NTFS filesystem (NT)
   12 - QDOS
   13 - Acorn RISCOS
  255 - unknown
  </code></pre>
  <p>However, Java's GZIP serialisation instead writes a zero in all cases, as can be seen on <a href="https://github.com/AdoptOpenJDK/openjdk-jdk11/blob/master/src/java.base/share/classes/java/util/zip/GZIPOutputStream.java#L193" rel="nofollow noreferrer">line 193 of GzipOutputStream.java</a>. I've run tests on four different operating systems to confirm no other code is modifying this header after writing.</p>
  <p>Why is this value hard-coded?</p>