@Override
        public int read() throws IOException {
            Memory result = stream.read(env, Memory.CONST_INT_1);
            return result.isString() ? result.getBinaryBytes(env.getDefaultCharset())[0] & 0xFF : -1;
        }
@param arg - File path or Stream object
@return
jphp-runtime/src/php/runtime/ext/core/classes/stream/Stream.java