Java Code Examples for org.springframework.core.io.InputStreamSource#getInputStream()

The following examples show how to use org.springframework.core.io.InputStreamSource#getInputStream() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MimeMessageHelper.java    From spring-analysis-note with MIT License 6 votes vote down vote up
/**
 * 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;
		}
	};
}
 
Example 2
Source File: MimeMessageHelper.java    From java-technology-stack with MIT License 6 votes vote down vote up
/**
 * 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;
		}
	};
}
 
Example 3
Source File: MimeMessageHelper.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
		}
	};
}
 
Example 4
Source File: MimeMessageHelper.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
		}
	};
}
 
Example 5
Source File: IntegrationTestApp.java    From cloudbreak with Apache License 2.0 5 votes vote down vote up
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;
    }
}