private void send_code_to_buffer(int code, OutputStream os)throws Exception	{
		int temp = codeLen;
		// Shift the code to the left of the last byte in bytes_buf
        bytes_buf[bufIndex] |= ((code&MASK[empty_bits])<<(8-empty_bits));
		code >>= empty_bits;
        temp -= empty_bits;
        // If the code is longer than the empty_bits
		while (temp > 0)
		{
			if ( ++bufIndex >= 0xff)
			{
				flush_buf(os,0xff);
			}
			bytes_buf[bufIndex] |= (code&0xff);
			code >>= 8;
			temp -= 8;
		}
		empty_bits = -temp;
	}
This is intended to be called first when writing an animated GIF
frame by frame.

@param os OutputStream for the animated GIF
@param logicalScreenWidth width of the logical screen. If it is less than
       or equal zero, it will be determined from the first frame
@param logicalScreenHeight height of the logical screen. If it is less than
       or equal zero, it will be determined from the first frame
@throws Exception
subs/gif-revert/src/main/java/com/engineer/gif/revert/lib/AnimatedGIFWriter.java