#62355 - unsplit packages - 1 - moved classes
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1832358 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
748c8f2583
commit
54f191b613
@ -14,8 +14,9 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
package org.apache.poi;
|
||||
package org.apache.poi.extractor;
|
||||
|
||||
import org.apache.poi.POIDocument;
|
||||
import org.apache.poi.hpsf.DocumentSummaryInformation;
|
||||
import org.apache.poi.hpsf.SummaryInformation;
|
||||
import org.apache.poi.hpsf.extractor.HPSFPropertiesExtractor;
|
@ -14,7 +14,7 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
package org.apache.poi;
|
||||
package org.apache.poi.extractor;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
@ -49,7 +49,6 @@ import org.apache.poi.util.IOUtils;
|
||||
import org.apache.poi.util.LocaleUtil;
|
||||
import org.apache.poi.util.POILogFactory;
|
||||
import org.apache.poi.util.POILogger;
|
||||
import org.apache.poi.xssf.usermodel.XSSFObjectData;
|
||||
|
||||
/**
|
||||
* This extractor class tries to identify various embedded documents within Excel files
|
||||
@ -115,11 +114,7 @@ public class EmbeddedExtractor implements Iterable<EmbeddedExtractor> {
|
||||
if (od.hasDirectoryEntry()) {
|
||||
data = extractOne((DirectoryNode)od.getDirectory());
|
||||
} else {
|
||||
String contentType = CONTENT_TYPE_BYTES;
|
||||
if (od instanceof XSSFObjectData) {
|
||||
contentType = ((XSSFObjectData)od).getObjectPart().getContentType();
|
||||
}
|
||||
data = new EmbeddedData(od.getFileName(), od.getObjectData(), contentType);
|
||||
data = new EmbeddedData(od.getFileName(), od.getObjectData(), od.getContentType());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.log(POILogger.WARN, "Entry not found / readable - ignoring OLE embedding", e);
|
@ -21,51 +21,42 @@ import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.apache.poi.EmptyFileException;
|
||||
import org.apache.poi.EncryptedDocumentException;
|
||||
import org.apache.poi.OldFileFormatException;
|
||||
import org.apache.poi.hssf.record.crypto.Biff8EncryptionKey;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||
import org.apache.poi.openxml4j.opc.OPCPackage;
|
||||
import org.apache.poi.openxml4j.opc.PackageAccess;
|
||||
import org.apache.poi.poifs.crypt.Decryptor;
|
||||
import org.apache.poi.poifs.filesystem.DirectoryNode;
|
||||
import org.apache.poi.poifs.filesystem.DocumentFactoryHelper;
|
||||
import org.apache.poi.poifs.filesystem.FileMagic;
|
||||
import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
|
||||
import org.apache.poi.poifs.filesystem.OfficeXmlFileException;
|
||||
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
||||
import org.apache.poi.util.IOUtils;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.apache.poi.util.Removal;
|
||||
|
||||
/**
|
||||
* Factory for creating the appropriate kind of Workbook
|
||||
* (be it {@link HSSFWorkbook} or {@link XSSFWorkbook}),
|
||||
* (be it {@link HSSFWorkbook} or XSSFWorkbook),
|
||||
* by auto-detecting from the supplied input.
|
||||
*/
|
||||
public class WorkbookFactory {
|
||||
/**
|
||||
* Creates a HSSFWorkbook from the given POIFSFileSystem
|
||||
* <p>Note that in order to properly release resources the
|
||||
* Workbook should be closed after use.
|
||||
*/
|
||||
public static Workbook create(POIFSFileSystem fs) throws IOException {
|
||||
return new HSSFWorkbook(fs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a HSSFWorkbook from the given NPOIFSFileSystem
|
||||
* <p>Note that in order to properly release resources the
|
||||
* Workbook should be closed after use.
|
||||
* Creates a HSSFWorkbook from the given NPOIFSFileSystem<p>
|
||||
*
|
||||
* Note that in order to properly release resources the
|
||||
* Workbook should be closed after use.
|
||||
*
|
||||
* @param fs The {@link NPOIFSFileSystem} to read the document from
|
||||
*
|
||||
* @return The created workbook
|
||||
*
|
||||
* @throws IOException if an error occurs while reading the data
|
||||
*/
|
||||
public static Workbook create(NPOIFSFileSystem fs) throws IOException {
|
||||
try {
|
||||
return create(fs, null);
|
||||
} catch (InvalidFormatException e) {
|
||||
// Special case of OOXML-in-POIFS which is broken
|
||||
throw new IOException(e);
|
||||
}
|
||||
return create(fs, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -78,28 +69,59 @@ public class WorkbookFactory {
|
||||
* @return The created Workbook
|
||||
*
|
||||
* @throws IOException if an error occurs while reading the data
|
||||
* @throws InvalidFormatException if the contents of the file cannot be parsed into a {@link Workbook}
|
||||
*/
|
||||
private static Workbook create(final NPOIFSFileSystem fs, String password) throws IOException, InvalidFormatException {
|
||||
DirectoryNode root = fs.getRoot();
|
||||
private static Workbook create(final NPOIFSFileSystem fs, String password) throws IOException {
|
||||
return create(fs.getRoot(), password);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a Workbook from the given NPOIFSFileSystem.
|
||||
*
|
||||
* @param root The {@link DirectoryNode} to start reading the document from
|
||||
*
|
||||
* @return The created Workbook
|
||||
*
|
||||
* @throws IOException if an error occurs while reading the data
|
||||
*/
|
||||
public static Workbook create(final DirectoryNode root) throws IOException {
|
||||
return create(root, null);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a Workbook from the given NPOIFSFileSystem, which may
|
||||
* be password protected
|
||||
*
|
||||
* @param root The {@link DirectoryNode} to start reading the document from
|
||||
* @param password The password that should be used or null if no password is necessary.
|
||||
*
|
||||
* @return The created Workbook
|
||||
*
|
||||
* @throws IOException if an error occurs while reading the data
|
||||
*/
|
||||
public static Workbook create(final DirectoryNode root, String password) throws IOException {
|
||||
// Encrypted OOXML files go inside OLE2 containers, is this one?
|
||||
if (root.hasEntry(Decryptor.DEFAULT_POIFS_ENTRY)) {
|
||||
InputStream stream = DocumentFactoryHelper.getDecryptedStream(fs, password);
|
||||
InputStream stream = null;
|
||||
try {
|
||||
stream = DocumentFactoryHelper.getDecryptedStream(root, password);
|
||||
|
||||
OPCPackage pkg = OPCPackage.open(stream);
|
||||
return create(pkg);
|
||||
return createXSSFWorkbook(stream);
|
||||
} finally {
|
||||
IOUtils.closeQuietly(stream);
|
||||
}
|
||||
}
|
||||
|
||||
// If we get here, it isn't an encrypted XLSX file
|
||||
// So, treat it as a regular HSSF XLS one
|
||||
// If we get here, it isn't an encrypted PPTX file
|
||||
// So, treat it as a regular HSLF PPT one
|
||||
boolean passwordSet = false;
|
||||
if (password != null) {
|
||||
Biff8EncryptionKey.setCurrentUserPassword(password);
|
||||
passwordSet = true;
|
||||
}
|
||||
try {
|
||||
return new HSSFWorkbook(root, true);
|
||||
return createHSSFWorkbook(root);
|
||||
} finally {
|
||||
if (passwordSet) {
|
||||
Biff8EncryptionKey.setCurrentUserPassword(null);
|
||||
@ -108,7 +130,9 @@ public class WorkbookFactory {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a XSSFWorkbook from the given OOXML Package
|
||||
* Creates a XSSFWorkbook from the given OOXML Package.
|
||||
* As the WorkbookFactory is located in the POI module, which doesn't know about the OOXML formats,
|
||||
* this can be only achieved by using an Object reference to the OPCPackage.
|
||||
*
|
||||
* <p>Note that in order to properly release resources the
|
||||
* Workbook should be closed after use.</p>
|
||||
@ -118,9 +142,13 @@ public class WorkbookFactory {
|
||||
* @return The created Workbook
|
||||
*
|
||||
* @throws IOException if an error occurs while reading the data
|
||||
*
|
||||
* @deprecated use XSSFWorkbookFactory.create
|
||||
*/
|
||||
public static Workbook create(OPCPackage pkg) throws IOException {
|
||||
return new XSSFWorkbook(pkg);
|
||||
@Deprecated
|
||||
@Removal(version = "4.2.0")
|
||||
public static Workbook create(Object pkg) throws IOException {
|
||||
return createXSSFWorkbook(pkg);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -128,8 +156,8 @@ public class WorkbookFactory {
|
||||
* the given InputStream.
|
||||
*
|
||||
* <p>Your input stream MUST either support mark/reset, or
|
||||
* be wrapped as a {@link BufferedInputStream}! Note that
|
||||
* using an {@link InputStream} has a higher memory footprint
|
||||
* be wrapped as a {@link BufferedInputStream}!
|
||||
* Note that using an {@link InputStream} has a higher memory footprint
|
||||
* than using a {@link File}.</p>
|
||||
*
|
||||
* <p>Note that in order to properly release resources the
|
||||
@ -142,24 +170,25 @@ public class WorkbookFactory {
|
||||
* @return The created Workbook
|
||||
*
|
||||
* @throws IOException if an error occurs while reading the data
|
||||
* @throws InvalidFormatException if the contents of the file cannot be parsed into a {@link Workbook}
|
||||
* @throws EncryptedDocumentException If the workbook given is password protected
|
||||
* @throws EncryptedDocumentException If the Workbook given is password protected
|
||||
*/
|
||||
public static Workbook create(InputStream inp) throws IOException, InvalidFormatException, EncryptedDocumentException {
|
||||
public static Workbook create(InputStream inp) throws IOException, EncryptedDocumentException {
|
||||
return create(inp, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the appropriate HSSFWorkbook / XSSFWorkbook from
|
||||
* the given InputStream, which may be password protected.<p>
|
||||
*
|
||||
* Note that using an {@link InputStream} has a higher memory footprint
|
||||
* than using a {@link File}.<p>
|
||||
* the given InputStream, which may be password protected.
|
||||
*
|
||||
* Note that in order to properly release resources the
|
||||
* <p>Your input stream MUST either support mark/reset, or
|
||||
* be wrapped as a {@link BufferedInputStream}!
|
||||
* Note that using an {@link InputStream} has a higher memory footprint
|
||||
* than using a {@link File}.</p>
|
||||
*
|
||||
* <p>Note that in order to properly release resources the
|
||||
* Workbook should be closed after use. Note also that loading
|
||||
* from an InputStream requires more memory than loading
|
||||
* from a File, so prefer {@link #create(File)} where possible.
|
||||
* from a File, so prefer {@link #create(File)} where possible.</p>
|
||||
*
|
||||
* @param inp The {@link InputStream} to read data from.
|
||||
* @param password The password that should be used or null if no password is necessary.
|
||||
@ -167,23 +196,20 @@ public class WorkbookFactory {
|
||||
* @return The created Workbook
|
||||
*
|
||||
* @throws IOException if an error occurs while reading the data
|
||||
* @throws InvalidFormatException if the contents of the file cannot be parsed into a {@link Workbook}
|
||||
* @throws EncryptedDocumentException If the wrong password is given for a protected file
|
||||
* @throws EmptyFileException If an empty stream is given
|
||||
*/
|
||||
public static Workbook create(InputStream inp, String password) throws IOException, InvalidFormatException, EncryptedDocumentException {
|
||||
public static Workbook create(InputStream inp, String password) throws IOException, EncryptedDocumentException {
|
||||
InputStream is = FileMagic.prepareToCheckMagic(inp);
|
||||
|
||||
FileMagic fm = FileMagic.valueOf(is);
|
||||
|
||||
|
||||
switch (fm) {
|
||||
case OLE2:
|
||||
NPOIFSFileSystem fs = new NPOIFSFileSystem(is);
|
||||
return create(fs, password);
|
||||
case OOXML:
|
||||
return new XSSFWorkbook(OPCPackage.open(is));
|
||||
default:
|
||||
throw new InvalidFormatException("Your InputStream was neither an OLE2 stream, nor an OOXML stream");
|
||||
case OLE2:
|
||||
NPOIFSFileSystem fs = new NPOIFSFileSystem(is);
|
||||
return create(fs, password);
|
||||
case OOXML:
|
||||
return createXSSFWorkbook(is);
|
||||
default:
|
||||
throw new IOException("Your InputStream was neither an OLE2 stream, nor an OOXML stream");
|
||||
}
|
||||
}
|
||||
|
||||
@ -198,10 +224,9 @@ public class WorkbookFactory {
|
||||
* @return The created Workbook
|
||||
*
|
||||
* @throws IOException if an error occurs while reading the data
|
||||
* @throws InvalidFormatException if the contents of the file cannot be parsed into a {@link Workbook}
|
||||
* @throws EncryptedDocumentException If the workbook given is password protected
|
||||
* @throws EncryptedDocumentException If the Workbook given is password protected
|
||||
*/
|
||||
public static Workbook create(File file) throws IOException, InvalidFormatException, EncryptedDocumentException {
|
||||
public static Workbook create(File file) throws IOException, EncryptedDocumentException {
|
||||
return create(file, null);
|
||||
}
|
||||
|
||||
@ -218,12 +243,10 @@ public class WorkbookFactory {
|
||||
* @return The created Workbook
|
||||
*
|
||||
* @throws IOException if an error occurs while reading the data
|
||||
* @throws InvalidFormatException if the contents of the file cannot be parsed into a {@link Workbook}
|
||||
* @throws EncryptedDocumentException If the wrong password is given for a protected file
|
||||
* @throws EmptyFileException If an empty stream is given
|
||||
*/
|
||||
public static Workbook create(File file, String password) throws IOException, InvalidFormatException, EncryptedDocumentException {
|
||||
return create(file, password, false);
|
||||
public static Workbook create(File file, String password) throws IOException, EncryptedDocumentException {
|
||||
return create(file, password, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -236,40 +259,71 @@ public class WorkbookFactory {
|
||||
* @param file The file to read data from.
|
||||
* @param password The password that should be used or null if no password is necessary.
|
||||
* @param readOnly If the Workbook should be opened in read-only mode to avoid writing back
|
||||
* changes when the document is closed.
|
||||
* changes when the document is closed.
|
||||
*
|
||||
* @return The created Workbook
|
||||
*
|
||||
* @throws IOException if an error occurs while reading the data
|
||||
* @throws InvalidFormatException if the contents of the file cannot be parsed into a {@link Workbook}
|
||||
* @throws EncryptedDocumentException If the wrong password is given for a protected file
|
||||
* @throws EmptyFileException If an empty stream is given
|
||||
*/
|
||||
public static Workbook create(File file, String password, boolean readOnly) throws IOException, InvalidFormatException, EncryptedDocumentException {
|
||||
if (! file.exists()) {
|
||||
public static Workbook create(File file, String password, boolean readOnly) throws IOException, EncryptedDocumentException {
|
||||
if (!file.exists()) {
|
||||
throw new FileNotFoundException(file.toString());
|
||||
}
|
||||
|
||||
try (NPOIFSFileSystem fs = new NPOIFSFileSystem(file, readOnly)) {
|
||||
NPOIFSFileSystem fs = null;
|
||||
try {
|
||||
fs = new NPOIFSFileSystem(file, readOnly);
|
||||
return create(fs, password);
|
||||
} catch(OfficeXmlFileException e) {
|
||||
// opening as .xls failed => try opening as .xlsx
|
||||
OPCPackage pkg = OPCPackage.open(file, readOnly ? PackageAccess.READ : PackageAccess.READ_WRITE); // NOSONAR
|
||||
try {
|
||||
return new XSSFWorkbook(pkg);
|
||||
} catch (Exception ioe) {
|
||||
// ensure that file handles are closed - use revert() to not re-write the file
|
||||
pkg.revert();
|
||||
// do not pkg.close();
|
||||
|
||||
if (ioe instanceof IOException) {
|
||||
throw (IOException)ioe;
|
||||
} else if (ioe instanceof RuntimeException) {
|
||||
throw (RuntimeException)ioe;
|
||||
} else {
|
||||
throw new IOException(ioe);
|
||||
}
|
||||
}
|
||||
IOUtils.closeQuietly(fs);
|
||||
return createXSSFWorkbook(file, readOnly);
|
||||
} catch(RuntimeException e) {
|
||||
IOUtils.closeQuietly(fs);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private static Workbook createHSSFWorkbook(Object... args) throws IOException, EncryptedDocumentException {
|
||||
return createWorkbook("org.apache.poi.hssf.usermodel.HSSFWorkbookFactory", args);
|
||||
}
|
||||
|
||||
private static Workbook createXSSFWorkbook(Object... args) throws IOException, EncryptedDocumentException {
|
||||
return createWorkbook("org.apache.poi.xssf.usermodel.XSSFWorkbookFactory", args);
|
||||
}
|
||||
|
||||
private static Workbook createWorkbook(String factoryClass, Object args[]) throws IOException, EncryptedDocumentException {
|
||||
try {
|
||||
Class<?> clazz = Thread.currentThread().getContextClassLoader().loadClass(factoryClass);
|
||||
Class<?> argsClz[] = new Class<?>[args.length];
|
||||
int i=0;
|
||||
for (Object o : args) {
|
||||
Class<?> c = o.getClass();
|
||||
if (Boolean.class.isAssignableFrom(c)) {
|
||||
c = boolean.class;
|
||||
} else if (InputStream.class.isAssignableFrom(c)) {
|
||||
c = InputStream.class;
|
||||
}
|
||||
argsClz[i++] = c;
|
||||
}
|
||||
Method m = clazz.getMethod("createWorkbook", argsClz);
|
||||
return (Workbook)m.invoke(null, args);
|
||||
} catch (InvocationTargetException e) {
|
||||
Throwable t = e.getCause();
|
||||
if (t instanceof IOException) {
|
||||
throw (IOException)t;
|
||||
} else if (t instanceof EncryptedDocumentException) {
|
||||
throw (EncryptedDocumentException)t;
|
||||
} else if (t instanceof OldFileFormatException) {
|
||||
throw (OldFileFormatException)t;
|
||||
} else if (t instanceof RuntimeException) {
|
||||
throw (RuntimeException)t;
|
||||
} else {
|
||||
throw new IOException(t.getMessage(), t);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -14,7 +14,7 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
package org.apache.poi;
|
||||
package org.apache.poi.ooxml;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.File;
|
@ -14,7 +14,7 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
package org.apache.poi;
|
||||
package org.apache.poi.ooxml;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
@ -14,7 +14,7 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
package org.apache.poi;
|
||||
package org.apache.poi.ooxml;
|
||||
|
||||
/**
|
||||
* Indicates a generic OOXML error.
|
@ -14,7 +14,7 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
package org.apache.poi;
|
||||
package org.apache.poi.ooxml;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
@ -14,9 +14,9 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
package org.apache.poi;
|
||||
package org.apache.poi.ooxml;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
import static org.apache.poi.ooxml.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
@ -14,7 +14,7 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
package org.apache.poi;
|
||||
package org.apache.poi.ooxml;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
@ -15,7 +15,7 @@
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
package org.apache.poi;
|
||||
package org.apache.poi.ooxml;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@ -23,7 +23,6 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.Reader;
|
||||
import java.io.StringReader;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.net.URL;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
@ -32,8 +31,7 @@ import java.util.Map;
|
||||
import javax.xml.stream.XMLStreamReader;
|
||||
|
||||
import org.apache.poi.openxml4j.opc.PackageNamespaces;
|
||||
import org.apache.poi.util.DocumentHelper;
|
||||
import org.apache.poi.util.Removal;
|
||||
import org.apache.poi.ooxml.util.DocumentHelper;
|
||||
import org.apache.xmlbeans.SchemaType;
|
||||
import org.apache.xmlbeans.SchemaTypeLoader;
|
||||
import org.apache.xmlbeans.XmlBeans;
|
@ -14,7 +14,7 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
package org.apache.poi.dev;
|
||||
package org.apache.poi.ooxml.dev;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
@ -14,7 +14,7 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
package org.apache.poi.dev;
|
||||
package org.apache.poi.ooxml.dev;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
@ -14,11 +14,11 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
package org.apache.poi.extractor;
|
||||
package org.apache.poi.ooxml.extractor;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.apache.poi.POITextExtractor;
|
||||
import org.apache.poi.extractor.POITextExtractor;
|
||||
|
||||
/**
|
||||
* A command line wrapper around {@link ExtractorFactory}, useful
|
@ -14,7 +14,7 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
package org.apache.poi.extractor;
|
||||
package org.apache.poi.ooxml.extractor;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
@ -25,9 +25,9 @@ import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.apache.poi.EncryptedDocumentException;
|
||||
import org.apache.poi.POIOLE2TextExtractor;
|
||||
import org.apache.poi.POITextExtractor;
|
||||
import org.apache.poi.POIXMLTextExtractor;
|
||||
import org.apache.poi.extractor.POIOLE2TextExtractor;
|
||||
import org.apache.poi.extractor.POITextExtractor;
|
||||
import org.apache.poi.extractor.OLE2ExtractorFactory;
|
||||
import org.apache.poi.hsmf.MAPIMessage;
|
||||
import org.apache.poi.hsmf.datatypes.AttachmentChunks;
|
||||
import org.apache.poi.hsmf.extractor.OutlookTextExtactor;
|
||||
@ -61,7 +61,6 @@ import org.apache.poi.xdgf.extractor.XDGFVisioExtractor;
|
||||
import org.apache.poi.xslf.extractor.XSLFPowerPointExtractor;
|
||||
import org.apache.poi.xslf.usermodel.XMLSlideShow;
|
||||
import org.apache.poi.xslf.usermodel.XSLFRelation;
|
||||
import org.apache.poi.xslf.usermodel.XSLFSlideShow;
|
||||
import org.apache.poi.xssf.extractor.XSSFBEventBasedExcelExtractor;
|
||||
import org.apache.poi.xssf.extractor.XSSFEventBasedExcelExtractor;
|
||||
import org.apache.poi.xssf.extractor.XSSFExcelExtractor;
|
||||
@ -125,7 +124,7 @@ public class ExtractorFactory {
|
||||
* 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() {
|
||||
return OLE2ExtractorFactory.getPreferEventExtractor();
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
package org.apache.poi;
|
||||
package org.apache.poi.ooxml.extractor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DateFormat;
|
||||
@ -24,6 +24,8 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.apache.poi.extractor.POITextExtractor;
|
||||
import org.apache.poi.ooxml.POIXMLDocument;
|
||||
import org.apache.poi.openxml4j.opc.internal.PackagePropertiesPart;
|
||||
import org.apache.poi.util.LocaleUtil;
|
||||
import org.openxmlformats.schemas.officeDocument.x2006.customProperties.CTProperty;
|
@ -15,13 +15,15 @@
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
package org.apache.poi;
|
||||
package org.apache.poi.ooxml.extractor;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.poi.POIXMLProperties.CoreProperties;
|
||||
import org.apache.poi.POIXMLProperties.CustomProperties;
|
||||
import org.apache.poi.POIXMLProperties.ExtendedProperties;
|
||||
import org.apache.poi.extractor.POITextExtractor;
|
||||
import org.apache.poi.ooxml.POIXMLDocument;
|
||||
import org.apache.poi.ooxml.POIXMLProperties.CoreProperties;
|
||||
import org.apache.poi.ooxml.POIXMLProperties.CustomProperties;
|
||||
import org.apache.poi.ooxml.POIXMLProperties.ExtendedProperties;
|
||||
import org.apache.poi.openxml4j.opc.OPCPackage;
|
||||
import org.apache.poi.openxml4j.util.ZipSecureFile;
|
||||
|
@ -15,7 +15,7 @@
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
package org.apache.poi.util;
|
||||
package org.apache.poi.ooxml.util;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@ -27,6 +27,8 @@ import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.stream.events.Namespace;
|
||||
|
||||
import org.apache.poi.util.POILogFactory;
|
||||
import org.apache.poi.util.POILogger;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.xml.sax.ErrorHandler;
|
@ -14,7 +14,7 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
package org.apache.poi.util;
|
||||
package org.apache.poi.ooxml.util;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.ListIterator;
|
@ -15,13 +15,14 @@
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
package org.apache.poi.util;
|
||||
package org.apache.poi.ooxml.util;
|
||||
|
||||
import org.apache.poi.openxml4j.opc.*;
|
||||
import org.apache.poi.openxml4j.opc.OPCPackage;
|
||||
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
|
||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||
import org.apache.poi.POIXMLException;
|
||||
import org.apache.poi.ooxml.POIXMLException;
|
||||
import org.apache.poi.util.IOUtils;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.URI;
|
@ -15,7 +15,7 @@
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
package org.apache.poi.util;
|
||||
package org.apache.poi.ooxml.util;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
@ -26,6 +26,8 @@ import javax.xml.XMLConstants;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
|
||||
import org.apache.poi.util.POILogFactory;
|
||||
import org.apache.poi.util.POILogger;
|
||||
import org.xml.sax.EntityResolver;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
@ -14,7 +14,7 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
package org.apache.poi.extractor;
|
||||
package org.apache.poi.extractor.ooxml;
|
||||
|
||||
import static org.apache.poi.POITestCase.assertContains;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
@ -30,9 +30,9 @@ import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.apache.poi.POIDataSamples;
|
||||
import org.apache.poi.POIOLE2TextExtractor;
|
||||
import org.apache.poi.POITextExtractor;
|
||||
import org.apache.poi.POIXMLTextExtractor;
|
||||
import org.apache.poi.extractor.POIOLE2TextExtractor;
|
||||
import org.apache.poi.extractor.POITextExtractor;
|
||||
import org.apache.poi.ooxml.extractor.POIXMLTextExtractor;
|
||||
import org.apache.poi.UnsupportedFileFormatException;
|
||||
import org.apache.poi.hdgf.extractor.VisioTextExtractor;
|
||||
import org.apache.poi.hpbf.extractor.PublisherTextExtractor;
|
||||
@ -43,6 +43,7 @@ import org.apache.poi.hssf.extractor.EventBasedExcelExtractor;
|
||||
import org.apache.poi.hssf.extractor.ExcelExtractor;
|
||||
import org.apache.poi.hwpf.extractor.Word6Extractor;
|
||||
import org.apache.poi.hwpf.extractor.WordExtractor;
|
||||
import org.apache.poi.ooxml.extractor.ExtractorFactory;
|
||||
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
|
||||
import org.apache.poi.openxml4j.opc.OPCPackage;
|
||||
import org.apache.poi.openxml4j.opc.PackageAccess;
|
@ -15,7 +15,7 @@
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
package org.apache.poi;
|
||||
package org.apache.poi.ooxml;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
@ -35,7 +35,8 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.poi.POIXMLDocumentPart.RelationPart;
|
||||
import org.apache.poi.POIDataSamples;
|
||||
import org.apache.poi.ooxml.POIXMLDocumentPart.RelationPart;
|
||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||
import org.apache.poi.openxml4j.exceptions.OpenXML4JRuntimeException;
|
||||
import org.apache.poi.openxml4j.opc.OPCPackage;
|
||||
@ -43,7 +44,7 @@ import org.apache.poi.openxml4j.opc.PackagePart;
|
||||
import org.apache.poi.openxml4j.opc.PackageRelationshipTypes;
|
||||
import org.apache.poi.util.IOUtils;
|
||||
import org.apache.poi.util.NullOutputStream;
|
||||
import org.apache.poi.util.PackageHelper;
|
||||
import org.apache.poi.ooxml.util.PackageHelper;
|
||||
import org.apache.poi.util.TempFile;
|
||||
import org.apache.poi.xslf.usermodel.XMLSlideShow;
|
||||
import org.apache.poi.xssf.usermodel.XSSFRelation;
|
@ -15,7 +15,7 @@
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
package org.apache.poi;
|
||||
package org.apache.poi.ooxml;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
@ -28,7 +28,7 @@ import java.io.IOException;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.poi.POIXMLProperties.CoreProperties;
|
||||
import org.apache.poi.ooxml.POIXMLProperties.CoreProperties;
|
||||
import org.apache.poi.openxml4j.util.Nullable;
|
||||
import org.apache.poi.util.IOUtils;
|
||||
import org.apache.poi.util.LocaleUtil;
|
||||
@ -73,7 +73,7 @@ public final class TestPOIXMLProperties {
|
||||
POIXMLProperties props = workbook.getProperties();
|
||||
assertNotNull(props);
|
||||
|
||||
org.apache.poi.POIXMLProperties.ExtendedProperties properties =
|
||||
POIXMLProperties.ExtendedProperties properties =
|
||||
props.getExtendedProperties();
|
||||
|
||||
org.openxmlformats.schemas.officeDocument.x2006.extendedProperties.CTProperties
|
||||
@ -94,7 +94,7 @@ public final class TestPOIXMLProperties {
|
||||
|
||||
POIXMLProperties newProps = newWorkbook.getProperties();
|
||||
assertNotNull(newProps);
|
||||
org.apache.poi.POIXMLProperties.ExtendedProperties newProperties =
|
||||
POIXMLProperties.ExtendedProperties newProperties =
|
||||
newProps.getExtendedProperties();
|
||||
|
||||
assertEquals(application, newProperties.getApplication());
|
@ -15,7 +15,7 @@
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
package org.apache.poi.util;
|
||||
package org.apache.poi.ooxml.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -40,6 +40,9 @@ import java.util.regex.Pattern;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.poi.util.IOUtils;
|
||||
import org.apache.poi.util.StringUtil;
|
||||
import org.apache.poi.util.SuppressForbidden;
|
||||
import org.junit.Test;
|
||||
import org.junit.internal.TextListener;
|
||||
import org.junit.runner.Description;
|
@ -14,7 +14,14 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
package org.apache.poi.util;
|
||||
package org.apache.poi.ooxml.util;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNotSame;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
||||
import javax.xml.XMLConstants;
|
||||
|
||||
@ -22,10 +29,6 @@ import org.junit.Test;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.XMLReader;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class TestSAXHelper {
|
||||
@Test
|
||||
public void testXMLReader() throws Exception {
|
@ -14,7 +14,7 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
package org.apache.poi.extractor;
|
||||
package org.apache.poi.extractor.ole2;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
@ -23,11 +23,11 @@ import java.io.InputStream;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.poi.POIOLE2TextExtractor;
|
||||
import org.apache.poi.POITextExtractor;
|
||||
import org.apache.poi.extractor.POIOLE2TextExtractor;
|
||||
import org.apache.poi.extractor.POITextExtractor;
|
||||
import org.apache.poi.extractor.OLE2ExtractorFactory;
|
||||
import org.apache.poi.hdgf.extractor.VisioTextExtractor;
|
||||
import org.apache.poi.hpbf.extractor.PublisherTextExtractor;
|
||||
import org.apache.poi.hslf.extractor.PowerPointExtractor;
|
||||
import org.apache.poi.hslf.usermodel.HSLFSlideShow;
|
||||
import org.apache.poi.hsmf.MAPIMessage;
|
||||
import org.apache.poi.hsmf.datatypes.AttachmentChunks;
|
@ -1,25 +0,0 @@
|
||||
/* ====================================================================
|
||||
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.converter;
|
||||
|
||||
import org.apache.poi.util.Beta;
|
||||
|
||||
@Beta
|
||||
public class ExcelToFoUtils extends AbstractExcelUtils
|
||||
{
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user