aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache
diff options
context:
space:
mode:
authorAndreas Beeker <kiwiwings@apache.org>2018-05-27 22:01:33 +0000
committerAndreas Beeker <kiwiwings@apache.org>2018-05-27 22:01:33 +0000
commit0c35761317208529c8855025017e7953d7d101cd (patch)
treeca3b2db6b6dbf0d28f6306305ee37721ac20f018 /src/java/org/apache
parent6ce329eca43ad902a132cf86e7b9853f652fc3c1 (diff)
downloadpoi-0c35761317208529c8855025017e7953d7d101cd.tar.gz
poi-0c35761317208529c8855025017e7953d7d101cd.zip
#62355 - unsplit packages - 2 - modified classes (not only imports)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1832359 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache')
-rw-r--r--src/java/org/apache/poi/extractor/OLE2ExtractorFactory.java6
-rw-r--r--src/java/org/apache/poi/hssf/usermodel/HSSFWorkbookFactory.java50
-rw-r--r--src/java/org/apache/poi/sl/usermodel/SlideShowFactory.java4
-rw-r--r--src/java/org/apache/poi/ss/usermodel/ObjectData.java4
4 files changed, 59 insertions, 5 deletions
diff --git a/src/java/org/apache/poi/extractor/OLE2ExtractorFactory.java b/src/java/org/apache/poi/extractor/OLE2ExtractorFactory.java
index 5e52f9d6c2..fda090729e 100644
--- a/src/java/org/apache/poi/extractor/OLE2ExtractorFactory.java
+++ b/src/java/org/apache/poi/extractor/OLE2ExtractorFactory.java
@@ -27,8 +27,6 @@ import java.util.Iterator;
import java.util.List;
import org.apache.poi.EncryptedDocumentException;
-import org.apache.poi.POIOLE2TextExtractor;
-import org.apache.poi.POITextExtractor;
import org.apache.poi.hssf.OldExcelFormatException;
import org.apache.poi.hssf.extractor.EventBasedExcelExtractor;
import org.apache.poi.hssf.extractor.ExcelExtractor;
@@ -108,7 +106,7 @@ public class OLE2ExtractorFactory {
* Should this thread use event based extractors is available?
* Checks the all-threads one first, then thread specific.
*/
- protected static boolean getPreferEventExtractor() {
+ public static boolean getPreferEventExtractor() {
if(allPreferEventExtractors != null) {
return allPreferEventExtractors;
}
@@ -156,7 +154,7 @@ public class OLE2ExtractorFactory {
private static Class<?> getScratchpadClass() {
try {
return OLE2ExtractorFactory.class.getClassLoader().loadClass(
- "org.apache.poi.extractor.OLE2ScratchpadExtractorFactory"
+ "org.apache.poi.extractor.ole2.OLE2ScratchpadExtractorFactory"
);
} catch (ClassNotFoundException e) {
LOGGER.log(POILogger.ERROR, "POI Scratchpad jar missing");
diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbookFactory.java b/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbookFactory.java
new file mode 100644
index 0000000000..f0eefd5e52
--- /dev/null
+++ b/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbookFactory.java
@@ -0,0 +1,50 @@
+/* ====================================================================
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+==================================================================== */
+
+package org.apache.poi.hssf.usermodel;
+
+import java.io.IOException;
+
+import org.apache.poi.poifs.filesystem.DirectoryNode;
+import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
+import org.apache.poi.ss.usermodel.WorkbookFactory;
+import org.apache.poi.util.Internal;
+
+/**
+ * Helper class which is instantiated by reflection from
+ * {@link WorkbookFactory#create(java.io.File)} and similar
+ */
+@Internal
+public class HSSFWorkbookFactory extends WorkbookFactory {
+ /**
+ * Creates a HSSFWorkbook from the given NPOIFSFileSystem<p>
+ * Note that in order to properly release resources the
+ * Workbook should be closed after use.
+ */
+ public static HSSFWorkbook createWorkbook(final NPOIFSFileSystem fs) throws IOException {
+ return new HSSFWorkbook(fs);
+ }
+
+ /**
+ * Creates a HSSFWorkbook from the given DirectoryNode<p>
+ * Note that in order to properly release resources the
+ * Workbook should be closed after use.
+ */
+ public static HSSFWorkbook createWorkbook(final DirectoryNode root) throws IOException {
+ return new HSSFWorkbook(root, true);
+ }
+}
diff --git a/src/java/org/apache/poi/sl/usermodel/SlideShowFactory.java b/src/java/org/apache/poi/sl/usermodel/SlideShowFactory.java
index 5f75258b9a..31c669cf03 100644
--- a/src/java/org/apache/poi/sl/usermodel/SlideShowFactory.java
+++ b/src/java/org/apache/poi/sl/usermodel/SlideShowFactory.java
@@ -189,7 +189,7 @@ public class SlideShowFactory {
case OOXML:
return createXSLFSlideShow(is);
default:
- throw new IllegalArgumentException("Your InputStream was neither an OLE2 stream, nor an OOXML stream");
+ throw new IOException("Your InputStream was neither an OLE2 stream, nor an OOXML stream");
}
}
@@ -314,6 +314,8 @@ public class SlideShowFactory {
throw (EncryptedDocumentException)t;
} else if (t instanceof OldFileFormatException) {
throw (OldFileFormatException)t;
+ } else if (t instanceof RuntimeException) {
+ throw (RuntimeException)t;
} else {
throw new IOException(t);
}
diff --git a/src/java/org/apache/poi/ss/usermodel/ObjectData.java b/src/java/org/apache/poi/ss/usermodel/ObjectData.java
index d157dba53d..3d21b1a8d2 100644
--- a/src/java/org/apache/poi/ss/usermodel/ObjectData.java
+++ b/src/java/org/apache/poi/ss/usermodel/ObjectData.java
@@ -62,4 +62,8 @@ public interface ObjectData extends SimpleShape {
* @return the preview picture
*/
PictureData getPictureData();
+
+ default String getContentType() {
+ return "binary/octet-stream";
+ }
}