当前位置: 首页>>代码示例>>Java>>正文


Java Representation.getStream方法代码示例

本文整理汇总了Java中org.restlet.representation.Representation.getStream方法的典型用法代码示例。如果您正苦于以下问题:Java Representation.getStream方法的具体用法?Java Representation.getStream怎么用?Java Representation.getStream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.restlet.representation.Representation的用法示例。


在下文中一共展示了Representation.getStream方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSaxSource

import org.restlet.representation.Representation; //导入方法依赖的package包/类
/**
 * Returns a SAX source.
 * 
 * @param xmlRepresentation
 *            The XML representation to wrap.
 * @return A SAX source.
 * @throws IOException
 */
public static javax.xml.transform.sax.SAXSource getSaxSource(
        Representation xmlRepresentation) throws IOException {
    javax.xml.transform.sax.SAXSource result = null;

    if (xmlRepresentation != null) {
        result = new javax.xml.transform.sax.SAXSource(new InputSource(
                xmlRepresentation.getStream()));

        if (xmlRepresentation.getLocationRef() != null) {
            result.setSystemId(xmlRepresentation.getLocationRef()
                    .getTargetRef().toString());
        }
    }

    return result;
}
 
开发者ID:restlet,项目名称:restlet-framework,代码行数:25,代码来源:XmlRepresentation.java

示例2: getSchema

import org.restlet.representation.Representation; //导入方法依赖的package包/类
/**
 * Returns the wrapped schema.
 * 
 * @return The wrapped schema.
 * @throws IOException
 */
private static javax.xml.validation.Schema getSchema(
        Representation schemaRepresentation) throws Exception {
    javax.xml.validation.Schema result = null;

    if (schemaRepresentation != null) {
        final javax.xml.transform.stream.StreamSource streamSource = new javax.xml.transform.stream.StreamSource(
                schemaRepresentation.getStream());
        result = javax.xml.validation.SchemaFactory.newInstance(
                getSchemaLanguageUri(schemaRepresentation)).newSchema(
                streamSource);
    }

    return result;
}
 
开发者ID:restlet,项目名称:restlet-framework,代码行数:21,代码来源:XmlRepresentation.java

示例3: FormReader

import org.restlet.representation.Representation; //导入方法依赖的package包/类
/**
 * Constructor.<br>
 * In case the representation does not define a character set, the UTF-8
 * character set is used.
 *
 * @param representation
 *            The web form content.
 * @throws IOException
 *             if the stream of the representation could not be opened.
 */
public FormReader(Representation representation) throws IOException {
    this.decoding = true;
    this.stream = representation.getStream();
    this.separator = '&';

    if (representation.getCharacterSet() != null) {
        this.characterSet = representation.getCharacterSet();
    } else {
        this.characterSet = CharacterSet.UTF_8;
    }
}
 
开发者ID:restlet,项目名称:restlet-framework,代码行数:22,代码来源:FormReader.java

示例4: writeResponseBody

import org.restlet.representation.Representation; //导入方法依赖的package包/类
protected void writeResponseBody(Representation responseEntity) throws IOException {
    try {
        // Send the entity to the client
        InputStream is = responseEntity.getStream();
        getNettyChannel().write(new HttpChunkedInput(new ChunkedStream(is)));
        getNettyChannel().writeAndFlush(LastHttpContent.EMPTY_LAST_CONTENT);
    } catch (IOException ioe) {
        // The stream was probably already closed by the
        // connector. Probably OK, low message priority.
        getLogger().debug("Exception while writing the entity stream.", ioe);
    }
}
 
开发者ID:restlet,项目名称:restlet-framework,代码行数:13,代码来源:NettyServerCall.java

示例5: FormReader

import org.restlet.representation.Representation; //导入方法依赖的package包/类
/**
 * Constructor.<br>
 * In case the representation does not define a character set, the UTF-8
 * character set is used.
 * 
 * @param representation
 *            The web form content.
 * @param decode
 *            Indicates if the parameters should be decoded using the given
 *            character set.
 * @throws IOException
 *             if the stream of the representation could not be opened.
 */
public FormReader(Representation representation, boolean decode)
        throws IOException {
    this.decode = decode;
    this.stream = representation.getStream();
    this.separator = '&';

    if (representation.getCharacterSet() != null) {
        this.characterSet = representation.getCharacterSet();
    } else {
        this.characterSet = CharacterSet.UTF_8;
    }
}
 
开发者ID:restlet,项目名称:restlet-framework,代码行数:26,代码来源:FormReader.java

示例6: getReader

import org.restlet.representation.Representation; //导入方法依赖的package包/类
/**
 * Returns the reader for the template source.
 * 
 * @param templateSource
 *            The template source {@link Representation}.
 * @param characterSet
 *            The reader character set.
 */
public Reader getReader(Object templateSource, String characterSet)
        throws IOException {
    Representation r = (Representation) templateSource;
    return new InputStreamReader(r.getStream(), characterSet);
}
 
开发者ID:restlet,项目名称:restlet-framework,代码行数:14,代码来源:ContextTemplateLoader.java


注:本文中的org.restlet.representation.Representation.getStream方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。