Compose a resource to a stream, possibly using pretty presentation for a human reader, and maybe a different choice in the xhtml narrative (used in the spec in one place, but should not be used in production)
@
4580
public void compose(OutputStream stream, Resource resource, boolean htmlPretty)  throws IOException {
		XMLWriter writer = new XMLWriter(stream, "UTF-8");
		writer.setPretty(style == OutputStyle.PRETTY);
		writer.start();
		compose(writer, resource, htmlPretty);
		writer.end();
	}
436343
function IconvHtmlStream(options) {
    this.buff = new Buffer([]);
    this.isBuffering = true;
    this.conv = null;
    options = options || {};
    this.rewrite = (options.rewrite !== false);
    this.inputEncoding = 'utf8';
    this.encoding = options.encoding = 'utf8'; // this is the *output* encoding
    this.conv = iconv.getEncoder(this.inputEncoding);
    Transform.call(this, options);
}
1121530
def render(self, data, accepted_media_type=None, renderer_context=None):
        
        if data is None:
            return ''

        stream = StringIO()

        xml = SimplerXMLGenerator(stream, self.charset)
        xml.startDocument()
        xml.startElement(self.root_tag_name, {})

        self._to_xml(xml, data)

        xml.endElement(self.root_tag_name)
        xml.endDocument()
        return stream.getvalue()
711375
function Resource(name, type, inline, element) {
  this.name = name;
  this.type = type;
  this.inline = inline;
  this.element = element;
}
1246832
private function outputStream(): ResourceOutputStream
    {
        if (null === $this->outputStream)
        {
            $this->outputStream = new ResourceOutputStream(self::createStream($this->host, $this->port), 65000);
        }

        return $this->outputStream;
    }
290663
function fetchResource(t, callback) {
  if (isContinuation(t)) {
    convertContinuation(t, callback);
  } else {
    fetchViaHttp(t, callback);
  }
}
1142795
public static InputStreamResource buildInputStreamResourceFrom(final String value, final String description) {
        val reader = new StringReader(value);
        val is = new ReaderInputStream(reader, StandardCharsets.UTF_8);
        return new InputStreamResource(is, description);
    }
1123737
function parseResource (err, responseSpec, next) {
      var resource = responseSpec ? responseSpec.body : undefined;
      this.invokeNext(err, resource, next);
    }
1042197
protected function writeRemote() {

    $contentType = $this->cxt('content_type');
    if (!empty($contentType)) {
      $this->obj->setContentType($contentType);
    }

    // Skip debug streams.
    if ($this->isNeverDirty) {
      return;
    }

    // Stream is dirty and needs a write.
    if ($this->isDirty) {
      $position = ftell($this->objStream);

      rewind($this->objStream);
      $this->container->save($this->obj, $this->objStream);

      fseek($this->objStream, SEEK_SET, $position);

    }
    $this->isDirty = FALSE;
  }
585930
function stream( $options = '' )
    {
        // setting the options allows the adjustment of the headers
        // values at the moment are:
        // 'Content-Disposition'=>'filename'  - sets the filename, though not too sure how well this will
        //        work as in my trial the browser seems to use the filename of the php file with .pdf on the end
        // 'Accept-Ranges'=>1 or 0 - if this is not set to 1, then this header is not included, off by default
        //    this header seems to have caused some problems despite tha fact that it is supposed to solve
        //    them, so I am leaving it off by default.
        // 'compress'=> 1 or 0 - apply content stream compression, this is on (1) by default
        if ( !is_array( $options ) )
        {
            $options = array();
        }
        if ( isset( $options['compress'] ) && $options['compress'] == 0 )
        {
            $tmp = $this->output( 1 );
        }
        else
        {
            $tmp = $this->output();
        }
        $tmp = ltrim( $tmp );

        ob_clean();

        header( 'Pragma: ' );
        header( 'Cache-Control: ' );
        /* Set cache time out to 10 seconds, this should be good enough to work around an IE bug */
        header( "Expires: ". gmdate( 'D, d M Y H:i:s', time() + 10 ) . ' GMT' );
        header( 'X-Powered-By: eZ Publish' );

        header( 'Content-Length: '.strlen( $tmp ) );
        header( 'Content-Type: application/pdf' );
        header( 'Content-Transfer-Encoding: binary' );
        header( 'Accept-Ranges: bytes' );

        ob_end_clean();

        echo $tmp;

        eZExecution::cleanExit();
    }
179962
def data_to_stream(self, data_element, stream):
        
        generator = \
            self._make_representation_generator(stream, self.resource_class,
                                                self._mapping)
        generator.run(data_element)
126597
public void format(XtextResource resource) {
		assert resource != null;
		final String result = formatResource(resource);
		// Write back to the resource
		try (StringInputStream stringInputStream = new StringInputStream(result)) {
			resource.load(stringInputStream, Collections.emptyMap());
		} catch (Exception exception) {
			throw Exceptions.sneakyThrow(exception);
		}
	}
144467
public static Drawable createFromResourceStream(Resources res, TypedValue value, InputStream is, String srcName, BitmapFactory.Options opts) {
        return Drawable.createFromResourceStream(res, value, is, srcName, opts);
    }
17239
public function createStream(string $content = ''): StreamInterface
    {
        $resource = fopen('php://temp', 'rw+');
        $stream = new Stream($resource);
        $stream->write($content);

        return $stream;
    }
147358
public Drawable createFromResourceStream(TypedValue value, InputStream is, String srcName) {
        return createFromResourceStream(value, is, srcName, null);
    }
101122
def compose(stream, Loader=Loader):
    
    loader = Loader(stream)
    try:
        return loader.get_single_node()
    finally:
        loader.dispose()
525669
public static function wrap($resource = '', $size = null)
    {
        if ($resource instanceof Stream) {
            return $resource;
        }

        $type = gettype($resource);

        if ($type == 'string') {
            return self::fromString($resource, $size);
        }

        if ($type == 'resource') {
            return new self($resource, $size);
        }

        throw new InvalidArgumentException('Invalid resource type: ' . $type);
    }