本文整理汇总了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;
}
示例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;
}
示例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;
}
}
示例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);
}
}
示例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;
}
}
示例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);
}