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


Java ByteArrayToXInputStreamAdapter类代码示例

本文整理汇总了Java中com.sun.star.lib.uno.adapter.ByteArrayToXInputStreamAdapter的典型用法代码示例。如果您正苦于以下问题:Java ByteArrayToXInputStreamAdapter类的具体用法?Java ByteArrayToXInputStreamAdapter怎么用?Java ByteArrayToXInputStreamAdapter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ByteArrayToXInputStreamAdapter类属于com.sun.star.lib.uno.adapter包,在下文中一共展示了ByteArrayToXInputStreamAdapter类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadAndExport

import com.sun.star.lib.uno.adapter.ByteArrayToXInputStreamAdapter; //导入依赖的package包/类
/**
 * Load and export.
 * @param inputStream
 *            the input stream
 * @param importOptions
 *            the import options
 * @param outputStream
 *            the output stream
 * @param exportOptions
 *            the export options
 * @throws Exception
 *             the exception
 */
@SuppressWarnings("unchecked")
private void loadAndExport(InputStream inputStream, Map/* <String,Object> */importOptions,
		OutputStream outputStream, Map/* <String,Object> */exportOptions) throws Exception {
	XComponentLoader desktop = openOfficeConnection.getDesktopObject();

	Map/* <String,Object> */loadProperties = new HashMap();
	loadProperties.putAll(getDefaultLoadProperties());
	loadProperties.putAll(importOptions);
	// doesn't work using InputStreamToXInputStreamAdapter; probably because
	// it's not XSeekable
	// property("InputStream", new
	// InputStreamToXInputStreamAdapter(inputStream))
	loadProperties.put("InputStream", new ByteArrayToXInputStreamAdapter(IOUtils.toByteArray(inputStream))); //$NON-NLS-1$

	XComponent document = desktop.loadComponentFromURL(
			"private:stream", "_blank", 0, toPropertyValues(loadProperties)); //$NON-NLS-1$ //$NON-NLS-2$
	if (document == null) {
		throw new OPException(Messages.getString("ooconverter.StreamOpenOfficeDocumentConverter.6")); //$NON-NLS-1$
	}

	refreshDocument(document);

	Map/* <String,Object> */storeProperties = new HashMap();
	storeProperties.putAll(exportOptions);
	storeProperties.put("OutputStream", new OutputStreamToXOutputStreamAdapter(outputStream)); //$NON-NLS-1$

	try {
		XStorable storable = (XStorable) UnoRuntime.queryInterface(XStorable.class, document);
		storable.storeToURL("private:stream", toPropertyValues(storeProperties)); //$NON-NLS-1$
	} finally {
		document.dispose();
	}
}
 
开发者ID:heartsome,项目名称:tmxeditor8,代码行数:47,代码来源:StreamOpenOfficeDocumentConverter.java

示例2: buildImageProperties

import com.sun.star.lib.uno.adapter.ByteArrayToXInputStreamAdapter; //导入依赖的package包/类
protected XPropertySet buildImageProperties(XGraphicProvider xGraphicProvider, Object oImage, byte[] imageContent)
        throws Exception {
    XPropertySet imageProperties = as(XPropertySet.class, oImage);

    PropertyValue[] propValues = new PropertyValue[]{new PropertyValue()};
    propValues[0].Name = "InputStream";
    propValues[0].Value = new ByteArrayToXInputStreamAdapter(imageContent);

    XGraphic graphic = xGraphicProvider.queryGraphic(propValues);
    if (graphic != null) {
        imageProperties.setPropertyValue("Graphic", graphic);

        imageProperties.setPropertyValue("HoriOrient", HoriOrientation.NONE);
        imageProperties.setPropertyValue("VertOrient", HoriOrientation.NONE);

        imageProperties.setPropertyValue("HoriOrientPosition", 0);
        imageProperties.setPropertyValue("VertOrientPosition", 0);
    }

    return imageProperties;
}
 
开发者ID:cuba-platform,项目名称:yarg,代码行数:22,代码来源:AbstractInliner.java


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