本文整理匯總了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);
}