Shift Register / Encoder

I think what you might want is actually called an I/O expander. The PCF8574 is the oldest I2C device of this kind still readily available. Other devices similar to it are like the mcp23016.

You would use the "WIRE" library to talk to these devices.

http://www.nxp.com/documents/data_sheet/PCF8574.pdf

You would have full control over many outputs (or inputs) and never use more than a few pins.