下面列出了org.springframework.core.io.InputStreamSource#getInputStream ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* Create an Activation Framework DataSource for the given InputStreamSource.
* @param inputStreamSource the InputStreamSource (typically a Spring Resource)
* @param contentType the content type
* @param name the name of the DataSource
* @return the Activation Framework DataSource
*/
protected DataSource createDataSource(
final InputStreamSource inputStreamSource, final String contentType, final String name) {
return new DataSource() {
@Override
public InputStream getInputStream() throws IOException {
return inputStreamSource.getInputStream();
}
@Override
public OutputStream getOutputStream() {
throw new UnsupportedOperationException("Read-only javax.activation.DataSource");
}
@Override
public String getContentType() {
return contentType;
}
@Override
public String getName() {
return name;
}
};
}
/**
* Create an Activation Framework DataSource for the given InputStreamSource.
* @param inputStreamSource the InputStreamSource (typically a Spring Resource)
* @param contentType the content type
* @param name the name of the DataSource
* @return the Activation Framework DataSource
*/
protected DataSource createDataSource(
final InputStreamSource inputStreamSource, final String contentType, final String name) {
return new DataSource() {
@Override
public InputStream getInputStream() throws IOException {
return inputStreamSource.getInputStream();
}
@Override
public OutputStream getOutputStream() {
throw new UnsupportedOperationException("Read-only javax.activation.DataSource");
}
@Override
public String getContentType() {
return contentType;
}
@Override
public String getName() {
return name;
}
};
}
/**
* Create an Activation Framework DataSource for the given InputStreamSource.
* @param inputStreamSource the InputStreamSource (typically a Spring Resource)
* @param contentType the content type
* @param name the name of the DataSource
* @return the Activation Framework DataSource
*/
protected DataSource createDataSource(
final InputStreamSource inputStreamSource, final String contentType, final String name) {
return new DataSource() {
@Override
public InputStream getInputStream() throws IOException {
return inputStreamSource.getInputStream();
}
@Override
public OutputStream getOutputStream() {
throw new UnsupportedOperationException("Read-only javax.activation.DataSource");
}
@Override
public String getContentType() {
return contentType;
}
@Override
public String getName() {
return name;
}
};
}
/**
* Create an Activation Framework DataSource for the given InputStreamSource.
* @param inputStreamSource the InputStreamSource (typically a Spring Resource)
* @param contentType the content type
* @param name the name of the DataSource
* @return the Activation Framework DataSource
*/
protected DataSource createDataSource(
final InputStreamSource inputStreamSource, final String contentType, final String name) {
return new DataSource() {
@Override
public InputStream getInputStream() throws IOException {
return inputStreamSource.getInputStream();
}
@Override
public OutputStream getOutputStream() {
throw new UnsupportedOperationException("Read-only javax.activation.DataSource");
}
@Override
public String getContentType() {
return contentType;
}
@Override
public String getName() {
return name;
}
};
}
private XmlSuite loadSuite(String suitePath, InputStreamSource resource) throws IOException {
IFileParser<XmlSuite> parser = getParser(suitePath);
try (InputStream inputStream = resource.getInputStream()) {
XmlSuite xmlSuite = parser.parse(suitePath, inputStream, true);
xmlSuite.setParallel(XmlSuite.ParallelMode.getValidParallel(parallel));
xmlSuite.setThreadCount(threadCount);
xmlSuite.setTimeOut(timeOut);
LOG.info("Test are running in: {} type of parallel mode, thread count: {} and with test timeout: {}", parallel.toUpperCase(), threadCount, timeOut);
return xmlSuite;
}
}