presto-orc/src/main/java/io/prestosql/orc/stream/BooleanOutputStream.java/BooleanOutputStream/writeBooleans
class BooleanOutputStream:    public void writeBooleans(int count, boolean value)
    {
        checkArgument(count >= 0, "count is negative");
        if (count == 0) {
            return;
        }

        if (bitsInData != 0) {
            int bitsToWrite = Math.min(count, 8 - bitsInData);
            if (value) {
                data |= getLowBitMask(bitsToWrite) << (8 - bitsInData - bitsToWrite);
            }

            bitsInData += bitsToWrite;
            count -= bitsToWrite;
            if (bitsInData == 8) {
                flushData();
            }
            else {
                // there were not enough bits to fill the current data
                verify(count == 0);
                return;
            }
        }

        // at this point there should be no pending data
        verify(bitsInData == 0);

        // write 8 bits at a time
        while (count >= 8) {
            if (value) {
                byteOutputStream.writeByte((byte) 0b1111_1111);
            }
            else {
                byteOutputStream.writeByte((byte) 0b0000_0000);
            }
            count -= 8;
        }

        // buffer remaining bits
        if (count > 0) {
            if (value) {
                data = getLowBitMask(count) << (8 - count);
            }
            bitsInData = count;
        }
    }