本文整理汇总了Java中com.sun.star.io.IOException类的典型用法代码示例。如果您正苦于以下问题:Java IOException类的具体用法?Java IOException怎么用?Java IOException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IOException类属于com.sun.star.io包,在下文中一共展示了IOException类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: loadDocument
import com.sun.star.io.IOException; //导入依赖的package包/类
private XComponent loadDocument(OfficeContext context, File inputFile) throws OfficeException {
if (!inputFile.exists()) {
throw new OfficeException("input document not found");
}
XComponentLoader loader = cast(XComponentLoader.class, context.getService(SERVICE_DESKTOP));
Map<String, ?> loadProperties = getLoadProperties(inputFile);
XComponent document = null;
try {
document = loader.loadComponentFromURL(toUrl(inputFile), "_blank", 0, toUnoProperties(loadProperties));
} catch (IllegalArgumentException illegalArgumentException) {
throw new OfficeException("could not load document: " + inputFile.getName(), illegalArgumentException);
} catch (ErrorCodeIOException errorCodeIOException) {
throw new OfficeException("could not load document: " + inputFile.getName() + "; errorCode: "
+ errorCodeIOException.ErrCode, errorCodeIOException);
} catch (IOException ioException) {
throw new OfficeException("could not load document: " + inputFile.getName(), ioException);
}
if (document == null) {
throw new OfficeException("could not load document: " + inputFile.getName());
}
XRefreshable refreshable = cast(XRefreshable.class, document);
if (refreshable != null) {
refreshable.refresh();
}
return document;
}
开发者ID:kuzavas,项目名称:ephesoft,代码行数:27,代码来源:AbstractConversionTask.java
示例2: saveTo
import com.sun.star.io.IOException; //导入依赖的package包/类
public File saveTo(File location) {
try {
location = location.getAbsoluteFile();
String targetUrl = "file://" + location.toString();
XStorable xStorable = UnoRuntime.queryInterface(XStorable.class, doc);
PropertyValue[] docArgs = new PropertyValue[1];
docArgs[0] = new PropertyValue();
docArgs[0].Name = "Overwrite";
docArgs[0].Value = Boolean.TRUE;
xStorable.storeAsURL(targetUrl, docArgs);
return location;
} catch (IOException e) {
throw new LibreOfficeException(e);
}
}
开发者ID:kamax-io,项目名称:libreoffice4j,代码行数:18,代码来源:SpreadsheetDocument.java
示例3: loadDocument
import com.sun.star.io.IOException; //导入依赖的package包/类
private XComponent loadDocument(OfficeContext context, File inputFile) throws OfficeException {
if (!inputFile.exists()) {
throw new OfficeException("input document not found");
}
XComponentLoader loader = cast(XComponentLoader.class, context.getService(SERVICE_DESKTOP));
Map<String,?> loadProperties = getLoadProperties(inputFile);
XComponent document = null;
try {
document = loader.loadComponentFromURL(toUrl(inputFile), "_blank", 0, toUnoProperties(loadProperties));
} catch (IllegalArgumentException illegalArgumentException) {
throw new OfficeException("could not load document: " + inputFile.getName(), illegalArgumentException);
} catch (ErrorCodeIOException errorCodeIOException) {
throw new OfficeException("could not load document: " + inputFile.getName() + "; errorCode: " + errorCodeIOException.ErrCode, errorCodeIOException);
} catch (IOException ioException) {
throw new OfficeException("could not load document: " + inputFile.getName(), ioException);
}
if (document == null) {
throw new OfficeException("could not load document: " + inputFile.getName());
}
return document;
}
开发者ID:qjx378,项目名称:wenku,代码行数:22,代码来源:AbstractConversionTask.java
示例4: storeDocument
import com.sun.star.io.IOException; //导入依赖的package包/类
private void storeDocument(XComponent document, File outputFile) throws OfficeException {
Map<String, ?> storeProperties = getStoreProperties(outputFile, document);
if (storeProperties == null) {
throw new OfficeException("unsupported conversion");
}
try {
PropertyValue[] storeProps = new PropertyValue[1];
storeProps[0] = new PropertyValue();
storeProps[0].Name = "FilterName";
storeProps[0].Value = "writer_pdf_Export";
cast(XStorable.class, document).storeToURL(toUrl(outputFile), storeProps);
} catch (ErrorCodeIOException errorCodeIOException) {
throw new OfficeException("could not store document: " + outputFile.getName() + "; errorCode: "
+ errorCodeIOException.ErrCode, errorCodeIOException);
} catch (IOException ioException) {
throw new OfficeException("could not store document: " + outputFile.getName(), ioException);
}
}
开发者ID:kuzavas,项目名称:ephesoft,代码行数:19,代码来源:AbstractConversionTask.java
示例5: createTempFile
import com.sun.star.io.IOException; //导入依赖的package包/类
protected File createTempFile(byte[] bytes) {
try {
String tempFileName = String.format("document%d", counter.incrementAndGet());
String tempFileExt = ".tmp";
if (StringUtils.isNotBlank(officeIntegration.getTemporaryDirPath())) {
Path tempDir = Paths.get(officeIntegration.getTemporaryDirPath());
tempDir.toFile().mkdirs();
temporaryFile = Files.createTempFile(
tempDir,
tempFileName,
tempFileExt)
.toFile();
} else {
temporaryFile = File.createTempFile(tempFileName, tempFileExt);
}
FileUtils.writeByteArrayToFile(temporaryFile, bytes);
return temporaryFile;
} catch (java.io.IOException e) {
throw new ReportFormattingException("Could not create temporary file for pdf conversion", e);
}
}
开发者ID:cuba-platform,项目名称:yarg,代码行数:23,代码来源:OfficeResourceProvider.java
示例6: storeDocument
import com.sun.star.io.IOException; //导入依赖的package包/类
private void storeDocument(XComponent document, File outputFile) throws OfficeException {
Map<String,?> storeProperties = getStoreProperties(outputFile, document);
if (storeProperties == null) {
throw new OfficeException("unsupported conversion");
}
try {
cast(XStorable.class, document).storeToURL(toUrl(outputFile), toUnoProperties(storeProperties));
} catch (ErrorCodeIOException errorCodeIOException) {
throw new OfficeException("could not store document: " + outputFile.getName() + "; errorCode: " + errorCodeIOException.ErrCode, errorCodeIOException);
} catch (IOException ioException) {
throw new OfficeException("could not store document: " + outputFile.getName(), ioException);
}
}
开发者ID:qjx378,项目名称:wenku,代码行数:14,代码来源:AbstractConversionTask.java
示例7: saveToFile
import com.sun.star.io.IOException; //导入依赖的package包/类
/**
* Speichert das übergebene Dokument in eine ODF-Datei. Die WollMux-Daten bleiben
* dabei erhalten.
*
* @author Ignaz Forster (D-III-ITD-D102)
* @throws java.io.IOException
*/
public static File saveToFile(XPrintModel pmod, boolean isODT) throws IOException,
java.io.IOException
{
XTextDocument textDocument = pmod.getTextDocument();
File outputDir =
new File(pmod.getProp(PROP_TARGETDIR,
System.getProperty("user.home") + "/Seriendruck").toString());
String filename;
TextComponentTags filePattern =
(TextComponentTags) pmod.getProp(PROP_FILEPATTERN, null);
if (filePattern != null)
filename = createOutputPathFromPattern(filePattern, pmod);
else
filename = L.m("Dokument.odt");
// jub .odt/.pdf ergänzen, falls nicht angegeben.
if (!filename.toLowerCase().endsWith(".odt")
&& !filename.toLowerCase().endsWith(".pdf"))
{
if (isODT)
filename = filename + ".odt";
else
filename = filename + ".pdf";
}
File file = new File(outputDir, filename);
saveOutputFile(file, textDocument);
return file;
}
开发者ID:WollMux,项目名称:WollMux,代码行数:41,代码来源:MailMergeNew.java
示例8: insertStylesFromURL
import com.sun.star.io.IOException; //导入依赖的package包/类
/**
* Diese Methode importiert alle in styles angegebenen Formatvorlagen aus dem
* durch url beschriebenen Fragment definiert und ersetzt dabei auch die bereits
* bestehenden Formatvorlagen des aktuellen Dokuments. Nach der erfolgreichen
* Einfügung der Formatvorlagen wird der Inhalt des Dokumentkommandos gelöscht,
* da ja mit dem Einfügen keine Textinhalte eingefügt werden.
*
* @param cmd
* das Dokumentkommando dessen Inhalt nach dem erfolgreichen Einfügen
* gelöscht wird.
* @param styles
* ein Set mit den in Kleinbuchstaben geschriebenen Namen der zu
* importierenden styles.
* @param url
* die URL des einzufügenden Textfragments
* @throws java.io.IOException
* @throws IOException
*/
private void insertStylesFromURL(DocumentCommand cmd, Set<String> styles, URL url)
throws java.io.IOException, IOException
{
// Workaround für Einfrierfehler von OOo, wenn ressource nicht auflösbar
// (ich habe nicht geprüft, ob das für insertStylesFromURL notwendig ist,
// aber schaden kann es bestimmt nicht)
WollMuxSingleton.checkURL(url);
// URL durch den URLTransformer von OOo jagen, damit die URL auch von OOo
// verarbeitet werden kann.
String urlStr = UNO.getParsedUNOUrl(url.toExternalForm()).Complete;
// Styles einfügen:
try
{
UnoProps props = new UnoProps();
props.setPropertyValue("OverwriteStyles", Boolean.TRUE);
props.setPropertyValue("LoadCellStyles",
Boolean.valueOf(styles.contains("cellstyles")));
props.setPropertyValue("LoadTextStyles",
Boolean.valueOf(styles.contains("textstyles")));
props.setPropertyValue("LoadFrameStyles",
Boolean.valueOf(styles.contains("framestyles")));
props.setPropertyValue("LoadPageStyles",
Boolean.valueOf(styles.contains("pagestyles")));
props.setPropertyValue("LoadNumberingStyles",
Boolean.valueOf(styles.contains("numberingstyles")));
XStyleFamiliesSupplier sfs = UNO.XStyleFamiliesSupplier(this.documentCommandInterpreter.getModel().doc);
XStyleLoader loader = UNO.XStyleLoader(sfs.getStyleFamilies());
loader.loadStylesFromURL(urlStr, props.getProps());
}
catch (NullPointerException e)
{
Logger.error(e);
}
// Textinhalt löschen
cmd.setTextRangeString("");
}
开发者ID:WollMux,项目名称:WollMux,代码行数:58,代码来源:DocumentExpander.java
示例9: saveAndClose
import com.sun.star.io.IOException; //导入依赖的package包/类
protected void saveAndClose(OfficeResourceProvider ooResourceProvider, XComponent xComponent, ReportOutputType outputType, OutputStream outputStream)
throws IOException {
OfficeOutputStream ooos = new OfficeOutputStream(outputStream);
String filterName;
if (ReportOutputType.pdf.equals(outputType)) {
filterName = PDF_OUTPUT_FILE;
} else {
filterName = MS_WORD_OUTPUT_FILE;
}
ooResourceProvider.saveXComponent(xComponent, ooos, filterName);
ooResourceProvider.closeXComponent(xComponent);
}
开发者ID:cuba-platform,项目名称:yarg,代码行数:13,代码来源:DocFormatter.java
示例10: loadXComponent
import com.sun.star.io.IOException; //导入依赖的package包/类
public XComponent loadXComponent(InputStream inputStream) throws com.sun.star.lang.IllegalArgumentException, IOException {
try {
return loadXComponent(IOUtils.toByteArray(inputStream));
} catch (java.io.IOException e) {
throw new ReportFormattingException("An error occurred while reading bytes", e);
}
}
开发者ID:cuba-platform,项目名称:yarg,代码行数:8,代码来源:OfficeResourceProvider.java
示例11: getXInputStream
import com.sun.star.io.IOException; //导入依赖的package包/类
public XInputStream getXInputStream(ReportTemplate reportTemplate) {
try {
return new OfficeInputStream(IOUtils.toByteArray(reportTemplate.getDocumentContent()));
} catch (java.io.IOException e) {
throw new OpenOfficeException("An error occurred while converting template to XInputStream", e);
}
}
开发者ID:cuba-platform,项目名称:yarg,代码行数:8,代码来源:OfficeResourceProvider.java
示例12: saveXComponent
import com.sun.star.io.IOException; //导入依赖的package包/类
public void saveXComponent(XComponent xComponent, XOutputStream xOutputStream, String filterName) throws IOException {
PropertyValue[] props = new PropertyValue[2];
props[0] = new PropertyValue();
props[1] = new PropertyValue();
props[0].Name = "OutputStream";
props[0].Value = xOutputStream;
props[1].Name = "FilterName";
props[1].Value = filterName;
XStorable xStorable = as(XStorable.class, xComponent);
xStorable.storeToURL("private:stream", props);
}
开发者ID:cuba-platform,项目名称:yarg,代码行数:12,代码来源:OfficeResourceProvider.java
示例13: loadDocument
import com.sun.star.io.IOException; //导入依赖的package包/类
protected void loadDocument(OfficeResourceProvider ooResourceProvider) throws com.sun.star.lang.IllegalArgumentException, IOException {
xComponent = ooResourceProvider.loadXComponent(reportTemplate.getDocumentContent());
officeComponent = new OfficeComponent(ooResourceProvider, xComponent);
}
开发者ID:cuba-platform,项目名称:yarg,代码行数:5,代码来源:DocFormatter.java
注:本文中的com.sun.star.io.IOException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论