Buggy code:
public class SevenZOutputFile implements Closeable { private final RandomAccessFile file ; private final List < SevenZArchiveEntry > files = new ArrayList < SevenZArchiveEntry > ( ) ; private int numNonEmptyStreams = 0 ; private CRC32 crc32 = new CRC32 ( ) ; private CRC32 compressedCrc32 = new CRC32 ( ) ; private long fileBytesWritten = 0 ; private boolean finished = false ; private CountingOutputStream currentOutputStream ; private SevenZMethod contentCompression = SevenZMethod . LZMA2 ; public SevenZOutputFile ( final File filename ) throws IOException { } public void setContentCompression ( SevenZMethod method ) { } public void close ( ) throws IOException { } public SevenZArchiveEntry createArchiveEntry ( final File inputFile , final String entryName ) throws IOException { } public void putArchiveEntry ( final ArchiveEntry archiveEntry ) throws IOException { } public void closeArchiveEntry ( ) throws IOException { } public void write ( final int b ) throws IOException { } public void write ( final byte [ ] b ) throws IOException { } public void write ( final byte [ ] b , final int off , final int len ) throws IOException { } public void finish ( ) throws IOException { } private OutputStream getCurrentOutputStream ( ) throws IOException { } private CountingOutputStream setupFileOutputStream ( ) throws IOException { } private void writeHeader ( final DataOutput header ) throws IOException { } private void writeStreamsInfo ( final DataOutput header ) throws IOException { } private void writePackInfo ( final DataOutput header ) throws IOException { } private void writeUnpackInfo ( final DataOutput header ) throws IOException { } private void writeFolder ( final DataOutput header ) throws IOException { } private void writeSubStreamsInfo ( final DataOutput header ) throws IOException { } private void writeFilesInfo ( final DataOutput header ) throws IOException { header . write ( kFilesInfo ) ; writeUint64 ( header , files . size ( ) ) ; writeFileEmptyStreams ( header ) ; writeFileEmptyFiles ( header ) ; writeFileAntiItems ( header ) ; writeFileNames ( header ) ; writeFileCTimes ( header ) ; writeFileATimes ( header ) ; writeFileMTimes ( header ) ; writeFileWindowsAttributes ( header ) ; <START_BUG> header . write ( 0 ) ; <END_BUG> } private void writeFileEmptyStreams ( final DataOutput header ) throws IOException { } private void writeFileEmptyFiles ( final DataOutput header ) throws IOException { } private void writeFileAntiItems ( final DataOutput header ) throws IOException { } private void writeFileNames ( final DataOutput header ) throws IOException { } private void writeFileCTimes ( final DataOutput header ) throws IOException { } private void writeFileATimes ( final DataOutput header ) throws IOException { } private void writeFileMTimes ( final DataOutput header ) throws IOException { } private void writeFileWindowsAttributes ( final DataOutput header ) throws IOException { } private void writeUint64 ( final DataOutput header , long value ) throws IOException { } private void writeBits ( final DataOutput header , final BitSet bits , final int length ) throws IOException { } private class OutputStreamWrapper extends OutputStream { @ Override public void write ( final int b ) throws IOException { } @ Override public void write ( final byte [ ] b ) throws IOException { } @ Override public void write ( final byte [ ] b , final int off , final int len ) throws IOException { } @ Override public void flush ( ) throws IOException { } @ Override public void close ( ) throws IOException { } } }

Fix:
header . write ( kEnd ) ;