@Override
        public int read(byte[] b, int off, int len) throws IOException {
            Memory result = stream.read(env, LongMemory.valueOf(len));
            if (!result.isString())
                return -1;

            byte[] copy = result.getBinaryBytes(env.getDefaultCharset());

            System.arraycopy(copy, 0, b, off, copy.length);

            return copy.length;
        }
@param arg - File path or Stream object
@return
jphp-runtime/src/php/runtime/ext/core/classes/stream/Stream.java