GEOS-5766 - MonitorInputStream ignores maxSize

(cherry picked from commit 55f4df7929573aa3f4247c454ec923342f892b71)