debugging serial port data

I think it would be helpful if there was a way to insert bytes into the serial port input (sorry, I should have been more specific) buffer so that serial communications code could be more easily checked.

(deleted)

spycatcher2k: Serial.write(21);

Insert 21 into buffer.

I rather suspect that the OP meant the input buffer rather than the output buffer