Re-port StringIO and methods required for it.

This incorporates missing flags, string modification, and encoding
logic into StringIO by doing a line-by-line behavior port from
MRI.

Fixes #1204.
Fixes #1242.
Merge remote-tracking branch 'github/jruby-1_7' into jruby-1_7
Merge branch 'jruby-1_7'

Conflicts:
	core/src/main/java/org/jruby/ext/stringio/RubyStringIO.java
Fix some merge issues for StringIO.
Fix regression in StringIO.open and unused imports.
Merge branch 'jruby-1_7'

Conflicts:
	core/src/main/java/org/jruby/ext/stringio/StringIO.java